mirror of
https://github.com/YunoHost-Apps/tvheadend_ynh.git
synced 2024-10-01 13:34:50 +02:00
README + improve scripts
This commit is contained in:
parent
5f02a437d8
commit
b6066a0087
6 changed files with 57 additions and 30 deletions
|
@ -61,5 +61,5 @@ To try the testing branch, please proceed like that.
|
|||
```
|
||||
sudo yunohost app install https://github.com/SylvainCecchetto/tvheadend_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade REPLACEBYYOURAPP -u https://github.com/SylvainCecchetto/tvheadend_ynh/tree/testing --debug
|
||||
sudo yunohost app upgrade tvheadend -u https://github.com/SylvainCecchetto/tvheadend_ynh/tree/testing --debug
|
||||
```
|
||||
|
|
|
@ -59,5 +59,5 @@ Pour essayer la branche testing, procédez comme suit.
|
|||
```
|
||||
sudo yunohost app install https://github.com/SylvainCecchetto/tvheadend_ynh/tree/testing --debug
|
||||
ou
|
||||
sudo yunohost app upgrade REPLACEBYYOURAPP -u https://github.com/SylvainCecchetto/tvheadend_ynh/tree/testing --debug
|
||||
sudo yunohost app upgrade tvheadend -u https://github.com/SylvainCecchetto/tvheadend_ynh/tree/testing --debug
|
||||
```
|
||||
|
|
|
@ -22,7 +22,7 @@ ynh_abort_if_errors
|
|||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -37,7 +37,7 @@ stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
|||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping $app service..." --time --weight=1
|
||||
ynh_script_progression --message="Stopping $app service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app.log"
|
||||
|
||||
|
@ -45,7 +45,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
|
|||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up $app config..." --time --weight=1
|
||||
ynh_script_progression --message="Backing up $app config..." --weight=4
|
||||
|
||||
ynh_backup --src_path="$final_path"
|
||||
ynh_backup --src_path="/etc/default/tvheadend"
|
||||
|
@ -53,7 +53,7 @@ ynh_backup --src_path="/etc/default/tvheadend"
|
|||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1
|
||||
ynh_script_progression --message="Backing up nginx web server configuration..." --weight=1
|
||||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
|
@ -63,14 +63,14 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
# BACKUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up logrotate configuration..." --time --weight=1
|
||||
ynh_script_progression --message="Backing up logrotate configuration..." --weight=1
|
||||
|
||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting $app service..." --time --weight=1
|
||||
ynh_script_progression --message="Starting $app service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app.log"
|
||||
|
||||
|
|
|
@ -21,10 +21,12 @@ new_path=$YNH_APP_NEW_PATH
|
|||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||
|
||||
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)
|
||||
|
@ -32,6 +34,7 @@ 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
|
||||
#=================================================
|
||||
|
@ -55,7 +58,7 @@ fi
|
|||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Stopping $app service..." --time --weight=1
|
||||
ynh_script_progression --message="Stopping $app service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app.log"
|
||||
|
||||
|
@ -63,7 +66,8 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
|
|||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating nginx web server configuration..." --time --weight=1
|
||||
|
||||
ynh_script_progression --message="Updating nginx web server configuration..." --weight=1
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
|
@ -89,12 +93,15 @@ 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"
|
||||
cp ../conf/tvheadend /etc/default/tvheadend
|
||||
ynh_replace_string --match_string="__CONF_DIR__" --replace_string="$final_path/.hts/tvheadend" --target_file="/etc/default/tvheadend"
|
||||
|
@ -110,14 +117,14 @@ ynh_store_file_checksum --file="/etc/default/tvheadend"
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting $app service..." --time --weight=1
|
||||
ynh_script_progression --message="Starting $app service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app.log"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
|
||||
ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -125,5 +132,5 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --time --last
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ ynh_abort_if_errors
|
|||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Loading settings..." --time --weight=1
|
||||
ynh_script_progression --message="Loading settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -33,7 +33,7 @@ stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --time --weight=1
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
||||
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||
|
@ -63,7 +63,7 @@ ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $stream_port
|
|||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installing dependencies..." --time --weight=1
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=11
|
||||
|
||||
if [ -n "$(uname -m | grep arm)" ]
|
||||
then
|
||||
|
@ -77,7 +77,7 @@ fi
|
|||
# INSTALL DEB PACKAGE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installing $app..." --time --weight=1
|
||||
ynh_script_progression --message="Installing $app..." --weight=51
|
||||
|
||||
temp_folder="$(mktemp -d)"
|
||||
tvheadend_deb_dst="$temp_folder/tvheadend_deb.deb"
|
||||
|
@ -109,7 +109,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring $app config..." --time --weight=1
|
||||
ynh_script_progression --message="Restoring $app config..." --weight=2
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
ynh_restore_file --origin_path="/etc/default/tvheadend"
|
||||
|
@ -133,7 +133,7 @@ yunohost service add $app --log "/var/log/$app.log"
|
|||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Configuring SSOwat..." --time --weight=1
|
||||
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
|
||||
|
||||
|
@ -142,7 +142,7 @@ ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
|
|||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Reloading nginx web server..." --time --weight=1
|
||||
ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -151,7 +151,7 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Starting $app service..." --time --weight=1
|
||||
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"
|
||||
|
@ -161,5 +161,5 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --time --last
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers
|
|||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -32,7 +32,7 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --time --weight=1
|
||||
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=4
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
|
@ -48,7 +48,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping $app service..." --time --weight=1
|
||||
ynh_script_progression --message="Stopping $app service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app.log"
|
||||
|
||||
|
@ -57,7 +57,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
|
|||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrading dependencies..." --time --weight=1
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=11
|
||||
|
||||
if [ -n "$(uname -m | grep arm)" ]
|
||||
then
|
||||
|
@ -73,7 +73,7 @@ fi
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading $app..." --time --weight=1
|
||||
ynh_script_progression --message="Upgrading $app..." --weight=51
|
||||
|
||||
temp_folder="$(mktemp -d)"
|
||||
tvheadend_deb_dst="$temp_folder/tvheadend_deb.deb"
|
||||
|
@ -94,11 +94,31 @@ then
|
|||
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..." --time --weight=1
|
||||
ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -107,7 +127,7 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed" --time --last
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue