mirror of
https://github.com/YunoHost-Apps/tvheadend_ynh.git
synced 2024-10-01 13:34:50 +02:00
Clean code
This commit is contained in:
parent
b6066a0087
commit
872b63d9ef
7 changed files with 25 additions and 133 deletions
|
@ -32,7 +32,7 @@
|
|||
"example": "example.com"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"name": "path_url",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path for ynhexample",
|
||||
|
|
|
@ -5,29 +5,26 @@
|
|||
#=================================================
|
||||
# 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
|
||||
|
||||
|
||||
#=================================================
|
||||
# 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 installation 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_url)
|
||||
superuser=$(ynh_app_setting_get --app=$app --key=superuser)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
||||
|
@ -41,7 +38,6 @@ ynh_script_progression --message="Stopping $app service..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app.log"
|
||||
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -57,7 +53,6 @@ ynh_script_progression --message="Backing up nginx web server configuration..."
|
|||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
|
@ -77,9 +72,6 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
|||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,14 +5,12 @@
|
|||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
old_path=$YNH_APP_OLD_PATH
|
||||
|
||||
|
@ -21,24 +19,21 @@ new_path=$YNH_APP_NEW_PATH
|
|||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path_url)
|
||||
superuser=$(ynh_app_setting_get --app=$app --key=superuser)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
||||
|
||||
|
||||
#=================================================
|
||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||
#=================================================
|
||||
|
||||
change_domain=0
|
||||
if [ "$old_domain" != "$new_domain" ]
|
||||
then
|
||||
|
@ -51,22 +46,18 @@ then
|
|||
change_path=1
|
||||
fi
|
||||
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Stopping $app service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app.log"
|
||||
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Updating nginx web server configuration..." --weight=1
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
@ -93,13 +84,11 @@ then
|
|||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
fi
|
||||
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
# ...
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Updating $app configuration..." --weight=1
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="/etc/default/tvheadend"
|
||||
|
@ -111,7 +100,6 @@ ynh_replace_string --match_string="__STREAM_PORT__" --replace_string="$stream_po
|
|||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/default/tvheadend"
|
||||
ynh_store_file_checksum --file="/etc/default/tvheadend"
|
||||
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
|
@ -131,6 +119,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||
|
||||
|
|
|
@ -11,16 +11,14 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
path_url=$YNH_APP_ARG_PATH_URL
|
||||
superuser=$YNH_APP_ARG_SUPERUSER
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
|
||||
|
@ -29,33 +27,29 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Validating installation parameters..." --weight=2
|
||||
|
||||
final_path=/home/hts # Default path from Tvheadend deb package
|
||||
final_path=/home/hts # Default path for Tvheadend deb package
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path_url --value=$path_url
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
ynh_app_setting_set --app=$app --key=superuser --value=$superuser
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
# FIND AND OPEN PORTS
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Configuring firewall..." --weight=16
|
||||
|
||||
# Find a free port for the web server
|
||||
|
@ -70,11 +64,9 @@ stream_port=$(ynh_find_port --port=9982)
|
|||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $stream_port
|
||||
ynh_app_setting_set --app=$app --key=stream_port --value=$stream_port
|
||||
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=11
|
||||
|
||||
if [ -n "$(uname -m | grep arm)" ]
|
||||
|
@ -84,12 +76,10 @@ else
|
|||
ynh_install_app_dependencies $pkg_dependencies_x86
|
||||
fi
|
||||
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEB PACKAGE
|
||||
# DOWNLOAD AND INSTALL TVHEADEND DEB PACKAGE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installing $app..." --weight=51
|
||||
ynh_script_progression --message="Downloading and installing $app..." --weight=51
|
||||
|
||||
temp_folder="$(mktemp -d)"
|
||||
tvheadend_deb_dst="$temp_folder/tvheadend_deb.deb"
|
||||
|
@ -109,24 +99,21 @@ ynh_package_install "$tvheadend_deb_dst"
|
|||
ynh_secure_remove --file="$temp_folder"
|
||||
|
||||
# Tvheadend automatically start after install
|
||||
# we stop it
|
||||
# we stop it before the configuration
|
||||
ynh_systemd_action --service_name=$app --action="stop"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Configuring nginx web server..." --weight=2
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
# MODIFY TVHEADEND CONFIG FILES
|
||||
#=================================================
|
||||
|
||||
# Modify /etc/default/tvheadend
|
||||
# Copy and modify /etc/default/tvheadend
|
||||
cp ../conf/tvheadend /etc/default/tvheadend
|
||||
ynh_replace_string --match_string="__CONF_DIR__" --replace_string="$final_path/.hts/tvheadend" --target_file="/etc/default/tvheadend"
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="/etc/default/tvheadend"
|
||||
|
@ -134,25 +121,21 @@ ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --
|
|||
ynh_replace_string --match_string="__STREAM_PORT__" --replace_string="$stream_port" --target_file="/etc/default/tvheadend"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/default/tvheadend"
|
||||
|
||||
# Modify .hts/tvheadend/superuser
|
||||
# Copy and modify /home/hts/.hts/tvheadend/superuser
|
||||
cp ../conf/superuser $final_path/.hts/tvheadend/superuser
|
||||
ynh_replace_string --match_string="__SUPERUSER__" --replace_string="$superuser" --target_file="$final_path/.hts/tvheadend/superuser"
|
||||
ynh_replace_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="$final_path/.hts/tvheadend/superuser"
|
||||
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
# STORE CONFIG FILES CHECKSUM
|
||||
#=================================================
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
# Calculate and store config files checksum into the app settings
|
||||
ynh_store_file_checksum --file="/etc/default/tvheadend"
|
||||
ynh_store_file_checksum --file="$final_path/.hts/tvheadend/superuser"
|
||||
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
|
@ -160,47 +143,34 @@ touch /var/log/$app.log
|
|||
chmod 666 /var/log/$app.log
|
||||
ynh_use_logrotate --logfile=/var/log/$app.log
|
||||
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add $app --log "/var/log/$app.log"
|
||||
|
||||
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
# START TVHEADEND SERVICE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Starting $app service..." --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app.log"
|
||||
#sudo service tvheadend start
|
||||
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
|
||||
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
|
||||
|
|
|
@ -5,20 +5,19 @@
|
|||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Loading installation 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_url)
|
||||
superuser=$(ynh_app_setting_get --app=$app --key=superuser)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
||||
|
@ -28,7 +27,6 @@ stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
|||
#=================================================
|
||||
# REMOVE SERVICE FROM ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
# Remove a service from the admin panel, added by `yunohost service add`
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
then
|
||||
|
@ -36,70 +34,56 @@ then
|
|||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
|
||||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
# STOP AND REMOVE TVHEADEND SERVICE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Stopping $app service..." --weight=1
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
|
||||
#=================================================
|
||||
# REMOVE TVHEADEND
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removing $app..." --weight=5
|
||||
|
||||
ynh_package_autopurge $app
|
||||
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=3
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removing $app main directory..." --weight=1
|
||||
|
||||
# Remove the app directory securely
|
||||
# Remove the app directory securely (/home/hts folder)
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removing nginx web server configuration..." --weight=1
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
# CLOSE TVHEADEND PORTS
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $port..." --weight=4
|
||||
|
@ -116,26 +100,23 @@ fi
|
|||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing $app log file..." --weight=1
|
||||
|
||||
# Remove the log files
|
||||
ynh_secure_remove --file="/var/log/$app.log"
|
||||
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removing the dedicated hts system user..." --weight=1
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=hts
|
||||
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed" --time --last
|
||||
|
||||
|
|
|
@ -11,25 +11,23 @@ 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_url)
|
||||
superuser=$(ynh_app_setting_get --app=$app --key=superuser)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
||||
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
|
@ -40,11 +38,9 @@ ynh_webpath_available --domain=$domain --path_url=$path_url \
|
|||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
|
||||
#=================================================
|
||||
# OPEN A PORT
|
||||
# OPEN TVHEADEND PORTS
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
ynh_die --message="Port $port already open (and maybe used by another application)"
|
||||
|
@ -58,11 +54,9 @@ fi
|
|||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
|
||||
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $stream_port
|
||||
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=11
|
||||
|
||||
if [ -n "$(uname -m | grep arm)" ]
|
||||
|
@ -72,11 +66,9 @@ else
|
|||
ynh_install_app_dependencies $pkg_dependencies_x86
|
||||
fi
|
||||
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEB PACKAGE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installing $app..." --weight=51
|
||||
|
||||
temp_folder="$(mktemp -d)"
|
||||
|
@ -103,36 +95,29 @@ ynh_systemd_action --service_name=$app --action="stop"
|
|||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
# RESTORE THE APP CONFIG FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring $app config..." --weight=2
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
ynh_restore_file --origin_path="/etc/default/tvheadend"
|
||||
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
yunohost service add $app --log "/var/log/$app.log"
|
||||
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
|
||||
|
@ -141,25 +126,19 @@ ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Starting $app service..." --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app.log"
|
||||
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
|
||||
|
|
|
@ -5,20 +5,19 @@
|
|||
#=================================================
|
||||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Loading installation 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_url)
|
||||
superuser=$(ynh_app_setting_get --app=$app --key=superuser)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
||||
|
@ -26,7 +25,6 @@ stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
|||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
|
@ -52,11 +50,9 @@ ynh_script_progression --message="Stopping $app service..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app.log"
|
||||
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=11
|
||||
|
||||
if [ -n "$(uname -m | grep arm)" ]
|
||||
|
@ -66,11 +62,9 @@ else
|
|||
ynh_install_app_dependencies $pkg_dependencies_x86
|
||||
fi
|
||||
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEB PACKAGE
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading $app..." --weight=51
|
||||
|
@ -97,39 +91,29 @@ fi
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Starting $app service..." --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app.log"
|
||||
#sudo service tvheadend start
|
||||
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
|
||||
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue