2019-10-15 15:56:27 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2022-03-08 23:09:32 +01:00
|
|
|
|
|
|
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
2019-10-15 15:56:27 +02:00
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2024-01-14 21:36:05 +01:00
|
|
|
# RESTORE THE APP MAIN DIR
|
2019-10-15 15:56:27 +02:00
|
|
|
#=================================================
|
2024-01-14 21:36:05 +01:00
|
|
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
2021-12-20 10:42:16 +01:00
|
|
|
|
2024-01-14 21:36:05 +01:00
|
|
|
ynh_restore_file --origin_path="$install_dir"
|
2019-10-15 15:56:27 +02:00
|
|
|
|
2024-01-14 21:36:05 +01:00
|
|
|
chown -R "$app:www-data" "$install_dir"
|
2019-10-23 10:16:15 +02:00
|
|
|
|
2019-10-20 18:28:27 +02:00
|
|
|
#=================================================
|
2024-01-14 21:36:05 +01:00
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
2019-10-20 18:28:27 +02:00
|
|
|
#=================================================
|
2024-01-14 21:36:05 +01:00
|
|
|
ynh_script_progression --message="Reinstalling $app package..." --weight=1
|
2019-10-15 15:56:27 +02:00
|
|
|
|
2024-01-14 21:36:05 +01:00
|
|
|
_install_tvheadend_package
|
2019-10-23 10:16:15 +02:00
|
|
|
# The deb install automatically create the hts system user
|
|
|
|
|
2019-10-15 15:56:27 +02:00
|
|
|
# Tvheadend automatically start after install
|
2019-10-20 18:28:27 +02:00
|
|
|
# we stop it before the configuration
|
2024-01-14 21:36:05 +01:00
|
|
|
ynh_systemd_action --service_name="$app" --action="stop"
|
2019-10-15 15:56:27 +02:00
|
|
|
|
|
|
|
#=================================================
|
2019-10-23 10:16:15 +02:00
|
|
|
# RESTORE TVHEADEND CONFIG FILES
|
2019-10-15 15:56:27 +02:00
|
|
|
#=================================================
|
2020-10-13 18:23:23 +02:00
|
|
|
ynh_script_progression --message="Restoring Tvheadend main directory and config files..." --weight=1
|
2019-10-15 15:56:27 +02:00
|
|
|
|
|
|
|
ynh_restore_file --origin_path="/etc/default/tvheadend"
|
|
|
|
|
|
|
|
#=================================================
|
2024-01-14 21:36:05 +01:00
|
|
|
# RESTORE SYSTEM CONFIGURATIONS
|
2019-10-20 18:28:27 +02:00
|
|
|
#=================================================
|
2024-01-14 21:36:05 +01:00
|
|
|
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
2019-10-20 18:28:27 +02:00
|
|
|
|
2024-01-14 21:36:05 +01:00
|
|
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
2019-10-15 15:56:27 +02:00
|
|
|
|
2024-01-14 21:36:05 +01:00
|
|
|
yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $stream_port
|
2019-10-15 15:56:27 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-03-08 23:09:32 +01:00
|
|
|
# START SYSTEMD SERVICE
|
2019-10-15 15:56:27 +02:00
|
|
|
#=================================================
|
2022-03-08 23:09:32 +01:00
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
2019-10-15 15:56:27 +02:00
|
|
|
|
2024-01-14 21:36:05 +01:00
|
|
|
ynh_systemd_action --service_name="$app" --action="start"
|
2019-10-15 15:56:27 +02:00
|
|
|
|
2022-03-08 23:09:32 +01:00
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
2019-10-15 15:56:27 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2022-03-08 23:09:32 +01:00
|
|
|
|
|
|
|
ynh_script_progression --message="Restoration completed for $app, HTSP port is $stream_port" --last
|