2020-08-17 17:29:58 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2022-06-02 00:45:50 +02:00
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
2020-08-17 17:29:58 +02:00
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2021-04-17 19:35:31 +02:00
|
|
|
# RESTORE THE APP MAIN DIR
|
2020-08-17 17:29:58 +02:00
|
|
|
#=================================================
|
2022-06-02 00:45:50 +02:00
|
|
|
ynh_script_progression --message="Restoring the app main directory..." --weight=20
|
2020-08-17 17:29:58 +02:00
|
|
|
|
2023-08-18 12:17:59 +02:00
|
|
|
ynh_restore_file --origin_path="$install_dir"
|
2020-08-17 17:29:58 +02:00
|
|
|
|
2023-08-18 12:17:59 +02:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:$app "$install_dir"
|
2022-06-02 00:45:50 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RESTORE THE DATA DIRECTORY
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
|
|
|
|
2023-08-18 12:17:59 +02:00
|
|
|
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
2022-06-02 00:45:50 +02:00
|
|
|
|
2023-08-18 12:17:59 +02:00
|
|
|
chown -R $app:$app "$data_dir"
|
2022-06-02 00:45:50 +02:00
|
|
|
|
2020-08-17 17:29:58 +02:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC RESTORATION
|
|
|
|
#=================================================
|
|
|
|
# REINSTALL DEPENDENCIES
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=5
|
|
|
|
|
|
|
|
# Install Nodejs
|
|
|
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
|
|
|
|
2023-08-18 12:17:59 +02:00
|
|
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
2020-08-17 17:29:58 +02:00
|
|
|
|
|
|
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
2020-12-11 09:12:07 +01:00
|
|
|
systemctl enable $app.service --quiet
|
2020-08-17 17:29:58 +02:00
|
|
|
|
2021-11-07 23:19:46 +01:00
|
|
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
2020-08-17 17:29:58 +02:00
|
|
|
|
2023-08-18 12:17:59 +02:00
|
|
|
yunohost service add $app --description="File storage server" --log="/var/log/$app/$app.log"
|
2020-08-17 17:29:58 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2021-11-07 23:19:46 +01:00
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=20
|
2020-08-17 17:29:58 +02:00
|
|
|
|
2021-04-17 19:35:31 +02:00
|
|
|
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Ready for requests!"
|
2020-08-17 17:29:58 +02:00
|
|
|
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|