2021-09-18 14:27:12 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RESTORE THE APP MAIN DIR
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoring the app main directory..." --weight=2
|
|
|
|
|
2023-03-31 20:51:42 +02:00
|
|
|
ynh_restore_file --origin_path="$install_dir"
|
2021-09-18 14:27:12 +02:00
|
|
|
|
2023-03-31 20:51:42 +02:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2021-09-18 14:27:12 +02:00
|
|
|
|
2021-09-18 14:36:33 +02:00
|
|
|
#=================================================
|
|
|
|
# RESTORE THE DATA DIRECTORY
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
|
|
|
|
2023-03-31 20:51:42 +02:00
|
|
|
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
2021-09-18 14:36:33 +02:00
|
|
|
|
2023-03-31 20:51:42 +02:00
|
|
|
chown -R $app:www-data "$data_dir"
|
2021-09-18 14:36:33 +02:00
|
|
|
|
|
|
|
#=================================================
|
2023-10-15 09:10:48 +02:00
|
|
|
# RESTORE THE POSTGRESQL DATABASE
|
2021-09-18 14:36:33 +02:00
|
|
|
#=================================================
|
2023-10-15 09:10:48 +02:00
|
|
|
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
|
2021-09-18 14:36:33 +02:00
|
|
|
|
2023-10-15 09:10:48 +02:00
|
|
|
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
2021-09-18 14:36:33 +02:00
|
|
|
|
2021-09-18 14:27:12 +02:00
|
|
|
#=================================================
|
2023-10-15 08:50:04 +02:00
|
|
|
# REINSTALL DEPENDENCIES
|
2021-09-18 14:27:12 +02:00
|
|
|
#=================================================
|
|
|
|
|
2023-10-15 08:50:04 +02:00
|
|
|
# Install Nodejs
|
|
|
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
2021-09-18 14:27:12 +02:00
|
|
|
|
2023-10-15 08:50:04 +02:00
|
|
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
2021-09-18 14:27:12 +02:00
|
|
|
|
|
|
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
|
|
|
systemctl enable $app.service --quiet
|
|
|
|
|
2023-10-15 08:50:04 +02:00
|
|
|
yunohost service add $app --description="Workflow Automation Tool" --log="/var/log/$app/$app.log"
|
|
|
|
|
2021-09-18 14:27:12 +02:00
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=8
|
|
|
|
|
2021-09-18 19:44:48 +02:00
|
|
|
ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Editor is now accessible via:"
|
2021-09-18 14:27:12 +02:00
|
|
|
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2021-09-18 15:01:21 +02:00
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|