1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kiwiirc_ynh.git synced 2024-09-03 19:35:59 +02:00
kiwiirc_ynh/scripts/restore

80 lines
2.7 KiB
Text
Raw Normal View History

2020-10-11 15:21:19 +02:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2022-02-04 09:04:28 +01:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=2
tempdir="$(mktemp -d)"
ynh_setup_source --dest_dir=$tempdir --source_id=app
2022-02-04 09:39:04 +01:00
ynh_exec_warn_less dpkg -i $tempdir/kiwiirc.deb
2022-02-04 09:04:28 +01:00
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
2022-02-04 09:49:47 +01:00
ynh_script_progression --message="Restoring various file..." --weight=1
2022-02-04 09:04:28 +01:00
ynh_restore_file --origin_path="/etc/kiwiirc"
2022-02-04 09:49:47 +01:00
ynh_restore_file --origin_path="/var/log/$app.log"
2020-10-25 09:00:51 +01:00
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
2021-08-30 14:24:54 +02:00
yunohost service add $app --description="Versatile web based messenger using IRC" --log="/var/log/$app/$app.log"
2020-10-25 09:00:51 +01:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
2022-02-04 09:04:28 +01:00
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd"
2020-10-25 09:00:51 +01:00
2020-10-11 15:21:19 +02:00
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
2021-09-24 07:43:11 +02:00
ynh_script_progression --message="Restoration completed for $app" --last