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

65 lines
2.3 KiB
Text
Raw Normal View History

2021-02-28 08:43:32 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# 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
2021-02-28 11:07:04 +01:00
#=================================================
2021-07-08 18:57:02 +02:00
# RESTORE THE APP MAIN DIR
2021-02-28 11:07:04 +01:00
#=================================================
2021-07-08 18:57:02 +02:00
ynh_script_progression --message="Restoring the app main directory..." --weight=3
2021-02-28 11:07:04 +01:00
2023-08-03 09:31:14 +02:00
ynh_restore_file --origin_path="$install_dir"
2021-07-08 18:57:02 +02:00
2023-08-03 09:31:14 +02:00
chown -R $app:www-data "$install_dir"
chmod +x $install_dir/komga.jar
2021-02-28 11:07:04 +01:00
2021-02-28 08:43:32 +01:00
#=================================================
2021-07-08 18:57:02 +02:00
# RESTORE THE DATA DIRECTORY
2021-02-28 08:43:32 +01:00
#=================================================
2021-07-08 18:57:02 +02:00
ynh_script_progression --message="Restoring the data directory..." --weight=1
2021-02-28 08:43:32 +01:00
2023-08-03 09:31:14 +02:00
ynh_restore_file --origin_path="$data_dir" --not_mandatory
2021-02-28 08:43:32 +01:00
2023-08-03 09:31:14 +02:00
chown -R $app:www-data "$data_dir"
2021-02-28 08:43:32 +01:00
#=================================================
2023-08-03 09:43:16 +02:00
# RESTORE SYSTEM CONFIGURATIONS
2021-02-28 08:43:32 +01:00
#=================================================
2023-08-03 09:43:16 +02:00
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
2021-02-28 08:43:32 +01:00
2023-08-03 09:43:16 +02:00
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
2021-02-28 08:43:32 +01:00
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
2021-02-28 19:29:02 +01:00
yunohost service add $app --description="Media server for your comics, manga and magazines" --log="/var/log/$app/$app.log"
2021-02-28 08:43:32 +01:00
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
2024-02-13 02:27:16 +01:00
mkdir -p "/var/log/$app"
chmod 640 "/var/log/$app"
2021-02-28 08:43:32 +01:00
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
2023-08-03 09:43:16 +02:00
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Started ApplicationKt"
2021-02-28 08:43:32 +01:00
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
2021-02-28 19:29:02 +01:00
ynh_script_progression --message="Restoration completed for $app" --last