mirror of
https://github.com/YunoHost-Apps/photoview_ynh.git
synced 2024-09-03 20:05:55 +02:00
83 lines
3 KiB
Bash
Executable file
83 lines
3 KiB
Bash
Executable file
#!/bin/bash
|
||
|
||
#=================================================
|
||
# IMPORT GENERIC HELPERS
|
||
#=================================================
|
||
|
||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||
source ../settings/scripts/_common.sh
|
||
source /usr/share/yunohost/helpers
|
||
|
||
#=================================================
|
||
# INSTALL GO
|
||
#=================================================
|
||
ynh_script_progression --message="Reinstalling Go..." --weight=10
|
||
|
||
ynh_install_go --go_version="$go_version"
|
||
|
||
#=================================================
|
||
# INSTALL NODEJS
|
||
#=================================================
|
||
ynh_script_progression --message="Reinstalling NodeJS..." --weight=10
|
||
|
||
ynh_install_nodejs --nodejs_version="$node_version"
|
||
|
||
#=================================================
|
||
# RESTORE THE APP MAIN DIR
|
||
#=================================================
|
||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||
|
||
ynh_restore_file --origin_path="$install_dir"
|
||
|
||
#=================================================
|
||
# RESTORE THE APP DATA DIR
|
||
#=================================================
|
||
ynh_script_progression --message="Restoring the app data directory..." --weight=1
|
||
|
||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||
|
||
#=================================================
|
||
# RESTORE THE MYSQL DATABASE
|
||
#=================================================
|
||
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
||
|
||
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
|
||
|
||
#=================================================
|
||
# SPECIFIC RESTORATION
|
||
|
||
set_go_vars
|
||
|
||
#=================================================
|
||
# RESTORE VARIOUS FILES
|
||
#=================================================
|
||
|
||
ynh_restore_file --origin_path="/var/log/$app/"
|
||
|
||
#=================================================
|
||
# RESTORE SYSTEM CONFIGURATIONS
|
||
#=================================================
|
||
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"
|
||
|
||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||
systemctl enable "$app.service" --quiet
|
||
yunohost service add "$app" --description="Photoview photo manager API" --log="/var/log/$app/$app.log"
|
||
|
||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||
|
||
#=================================================
|
||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||
#=================================================
|
||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||
|
||
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
|
||
|
||
ynh_systemd_action --service_name=nginx --action=reload
|
||
|
||
#=================================================
|
||
# END OF SCRIPT
|
||
#=================================================
|
||
|
||
ynh_script_progression --message="Restoration completed for $app" --last
|