#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=3 ynh_systemd_action --service_name="$app" --action="stop" #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= # ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Downloading and installing $app package..." --weight=1 chown -R "$app:www-data" "$install_dir" _install_tvheadend_package # The deb install automatically create the hts system user # Tvheadend automatically start after install # we stop it before the configuration ynh_systemd_action --service_name="$app" --action="stop" #================================================= # MODIFY TVHEADEND CONFIG FILES #================================================= ynh_script_progression --message="Update configuration files..." --weight=1 # Copy and modify /etc/default/tvheadend conf_dir=$install_dir/.hts/tvheadend ynh_app_setting_set --app="$app" --key=conf_dir --value="$conf_dir" if [ "$path" = "/" ]; then ynh_add_config --template="tvheadend_no_subpath" --destination="/etc/default/tvheadend" else ynh_add_config --template="tvheadend" --destination="/etc/default/tvheadend" fi #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config yunohost service add "$app" --description="TV streaming server and recorder" --needs_exposed_ports $stream_port #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name="$app" --action="start" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Upgrade of $app completed, HTSP port is $stream_port" --last