2014-08-27 23:42:00 +02:00
#!/bin/bash
2020-10-11 15:21:19 +02:00
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2024-08-31 00:59:03 +02:00
ynh_script_progression "Setting up source files..."
2021-07-09 07:31:16 +02:00
2024-02-05 13:11:42 +01:00
ynh_setup_source --source_id="main" --dest_dir="$install_dir"
2021-07-09 07:31:16 +02:00
2022-02-03 23:58:23 +01:00
#=================================================
# ADD A CONFIGURATION
#=================================================
2024-08-31 00:59:03 +02:00
ynh_script_progression "Adding $app's configuration..."
2022-02-03 23:56:15 +01:00
2024-08-31 00:59:03 +02:00
ynh_config_add --template="config.conf" --destination="$install_dir/config.conf"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config.conf"
2022-02-03 23:56:15 +01:00
2024-08-31 00:59:03 +02:00
ynh_config_add --template="client.json" --destination="$install_dir/www/static/client.json"
2024-02-05 13:11:42 +01:00
chmod 400 "$install_dir/www/static/client.json"
2024-02-05 14:30:09 +01:00
2024-08-31 00:59:03 +02:00
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir"
2020-10-11 15:21:19 +02:00
#=================================================
2024-02-05 13:11:42 +01:00
# SYSTEM CONFIGURATION
2020-10-11 15:21:19 +02:00
#=================================================
2024-08-31 00:59:03 +02:00
ynh_script_progression "Adding system configurations related to $app..."
2020-10-11 15:21:19 +02:00
# Create a dedicated NGINX config
2024-08-31 00:59:03 +02:00
ynh_config_add_nginx
2020-10-11 15:21:19 +02:00
2024-08-31 00:59:03 +02:00
ynh_config_add_systemd
2024-02-05 15:39:09 +01:00
yunohost service add "$app" --description="Versatile web based messenger using IRC" --log="/var/log/$app/$app.log"
# Use logrotate to manage application logfile(s)
2024-08-31 00:59:03 +02:00
ynh_config_add_logrotate
2020-10-25 09:00:51 +01:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2024-08-31 00:59:03 +02:00
ynh_script_progression "Starting $app's systemd service..."
2020-10-25 09:00:51 +01:00
# Start a systemd service
2024-08-31 00:59:03 +02:00
ynh_systemctl --service="$app" --action="restart" --log_path="systemd"
2020-10-11 15:21:19 +02:00
#=================================================
# END OF SCRIPT
#=================================================
2014-08-27 23:42:00 +02:00
2024-08-31 00:59:03 +02:00
ynh_script_progression "Installation of $app completed"