2017-07-23 17:46:25 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-05-04 11:52:10 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2020-07-18 11:46:45 +02:00
|
|
|
source ../settings/scripts/_common.sh
|
2017-07-23 17:46:25 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2021-03-18 11:26:27 +01:00
|
|
|
# RESTORE THE APP MAIN DIR
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
2022-05-28 01:29:55 +02:00
|
|
|
ynh_script_progression --message="Restoring the app main directory..." --weight=6
|
2017-07-23 17:46:25 +02:00
|
|
|
|
2023-03-12 08:24:05 +01:00
|
|
|
ynh_restore_file --origin_path="$install_dir"
|
2017-07-23 17:46:25 +02:00
|
|
|
|
2023-03-12 08:24:05 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:$app "$install_dir"
|
|
|
|
chmod 600 "$install_dir/config/config.js"
|
2020-07-18 11:46:45 +02:00
|
|
|
|
2022-12-09 18:01:27 +01:00
|
|
|
#=================================================
|
|
|
|
# APPLY FOLDER GROUP RIGHTS FOR WWW-DATA
|
|
|
|
#=================================================
|
2023-03-12 08:42:18 +01:00
|
|
|
|
2023-03-12 08:24:05 +01:00
|
|
|
chgrp -R www-data $install_dir
|
2022-12-09 18:01:27 +01:00
|
|
|
|
2020-07-18 11:46:45 +02:00
|
|
|
#=================================================
|
|
|
|
# REINSTALL DEPENDENCIES
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
2023-03-12 08:42:18 +01:00
|
|
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=7
|
2017-07-23 17:46:25 +02:00
|
|
|
|
2022-05-28 01:29:55 +02:00
|
|
|
# Define and install dependencies
|
2020-07-18 11:46:45 +02:00
|
|
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
2018-05-04 11:52:10 +02:00
|
|
|
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
2023-03-12 08:42:18 +01:00
|
|
|
# RESTORE SYSTEM CONFIGURATIONS
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
2023-03-12 08:42:18 +01:00
|
|
|
# RESTORE THE PHP-FPM CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
|
|
|
|
|
|
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
2017-07-23 17:46:25 +02:00
|
|
|
|
2020-07-18 11:46:45 +02:00
|
|
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
2020-12-04 11:33:12 +01:00
|
|
|
systemctl enable $app.service --quiet
|
2017-07-23 17:46:25 +02:00
|
|
|
|
2020-12-04 11:33:12 +01:00
|
|
|
yunohost service add $app --description="Zero Knowledge realtime collaborative editor" --log="/var/log/$app/$app.log"
|
2017-07-23 17:46:25 +02:00
|
|
|
|
2020-07-18 11:46:45 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
2023-03-12 08:42:18 +01:00
|
|
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
2017-07-23 17:46:25 +02:00
|
|
|
#=================================================
|
2023-03-12 08:42:18 +01:00
|
|
|
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
|
|
|
|
2023-12-21 13:07:41 +01:00
|
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
2020-07-18 11:46:45 +02:00
|
|
|
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2017-07-23 17:46:25 +02:00
|
|
|
|
2021-09-19 08:33:36 +02:00
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|