mirror of
https://github.com/YunoHost-Apps/lidarr_ynh.git
synced 2024-09-03 19:35:58 +02:00
87 lines
3.5 KiB
Bash
Executable file
87 lines
3.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# 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
|
|
|
|
#=================================================
|
|
# STANDARD RESTORATION STEPS
|
|
#=================================================
|
|
# RESTORE THE NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression "Restoring the NGINX configuration..."
|
|
|
|
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
#=================================================
|
|
# RESTORE THE APP MAIN DIR
|
|
#=================================================
|
|
ynh_script_progression "Restoring the app main directory..."
|
|
|
|
ynh_restore "$install_dir"
|
|
|
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app: "$install_dir"
|
|
#=================================================
|
|
# RESTORE THE APP DATA DIR
|
|
#=================================================
|
|
ynh_script_progression "Restoring the app data directory..."
|
|
|
|
ynh_restore "$data_dir"
|
|
|
|
chown -R $app: "$data_dir"
|
|
|
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$data_dir/config.xml"
|
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$data_dir/config.xml"
|
|
|
|
#=================================================
|
|
# YUNOHOST MULTIMEDIA INTEGRATION
|
|
#=================================================
|
|
ynh_script_progression "Adding multimedia directories..."
|
|
|
|
# Build YunoHost multimedia directories
|
|
ynh_multimedia_build_main_dir
|
|
# Enable writing into these directories
|
|
ynh_multimedia_addaccess $app
|
|
|
|
#=================================================
|
|
# RESTORE SYSTEMD
|
|
#=================================================
|
|
ynh_script_progression "Restoring $app's systemd service..."
|
|
|
|
ynh_restore "/etc/systemd/system/$app.service"
|
|
systemctl enable $app.service --quiet
|
|
|
|
#=================================================
|
|
# INTEGRATE SERVICE IN YUNOHOST
|
|
#=================================================
|
|
ynh_script_progression "Integrating service in YunoHost..."
|
|
|
|
yunohost service add $app --description="Lidarr daemon" --log="$data_dir/logs/lidarr.txt"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression "Starting $app's systemd service..."
|
|
|
|
ynh_systemctl --service=$app --action="start" --log_path="systemd" --wait_until="Application started"
|
|
|
|
#=================================================
|
|
# RESTORE THE LOGROTATE CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression "Restoring the logrotate configuration..."
|
|
|
|
ynh_restore "/etc/logrotate.d/$app"
|
|
|
|
#=================================================
|
|
# RELOAD NGINX
|
|
#=================================================
|
|
ynh_script_progression "Reloading NGINX web server..."
|
|
|
|
ynh_systemctl --service=nginx --action=reload
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression "Restoration completed for $app"
|