1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/tvheadend_ynh.git synced 2024-10-01 13:34:50 +02:00

Fix linter

This commit is contained in:
ericgaspar 2021-12-20 10:42:16 +01:00
parent d1b954bbd1
commit ea5eb155d3
5 changed files with 31 additions and 49 deletions

View file

@ -1,8 +1,4 @@
location __PATH__ {
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
proxy_pass http://127.0.0.1:__PORT__;
proxy_set_header Host $host;

View file

@ -11,12 +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
superuser=$YNH_APP_ARG_SUPERUSER
@ -62,9 +64,8 @@ ynh_app_setting_set --app=$app --key=stream_port --value=$stream_port
# Open ports
ynh_script_progression --message="Configuring firewall..." --weight=15
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $stream_port
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $stream_port
#=================================================
# INSTALL DEPENDENCIES
@ -142,7 +143,7 @@ ynh_add_nginx_config
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="TV streaming server and recorder" --needs_exposed_ports $port $stream_port
yunohost service add $app --description="TV streaming server and recorder" --needs_exposed_ports $stream_port
#=================================================
# SETUP SSOWAT
@ -175,4 +176,4 @@ ynh_systemd_action --service_name=$app --action="start"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of Tvheadend completed, HTTP port is $port and HTSP port is $stream_port" --last
ynh_script_progression --message="Installation of Tvheadend completed, HTSP port is $stream_port" --last

View file

@ -74,7 +74,7 @@ ynh_script_progression --message="Removing Tvheadend main directory and config f
# Remove the app directory securely (/home/hts folder)
## Use rm -r because ynh_secure_remove says that /home/hts is not an acceptable path to delete
rm -r $final_path
ynh_secure_remove --file="$final_path"
ynh_secure_remove --file="/etc/default/tvheadend"
#=================================================
@ -88,11 +88,6 @@ ynh_remove_nginx_config
#=================================================
# CLOSE PORTS
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..." --weight=8
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
if yunohost firewall list | grep -q "\- $stream_port$"
then

View file

@ -11,6 +11,7 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -35,8 +36,7 @@ stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=16
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD MODIFICATIONS
@ -44,10 +44,6 @@ test ! -d $final_path \
# OPEN TVHEADEND PORTS
#=================================================
ynh_script_progression --message="Configuring firewall..." --weight=15
if yunohost firewall list | grep -q "\- $port$"
then
ynh_die --message="Port $port already open (and maybe used by another application)"
fi
if yunohost firewall list | grep -q "\- $stream_port$"
then
@ -121,21 +117,13 @@ ynh_script_progression --message="Restoring NGINX web server configuration..." -
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="TV streaming server and recorder" --needs_exposed_ports $port $stream_port
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
ynh_permission_update --permission="main" --add="visitors"
#=================================================
# RELOAD NGINX
#=================================================
@ -160,5 +148,4 @@ ynh_systemd_action --service_name=$app --action="start"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of Tvheadend completed, HTTP port is $port and HTSP port is $stream_port" --last
ynh_script_progression --message="Installation of Tvheadend completed, HTSP port is $stream_port" --last

View file

@ -5,6 +5,7 @@
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
@ -27,6 +28,7 @@ stream_port=$(ynh_app_setting_get --app=$app --key=stream_port)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
@ -52,10 +54,26 @@ ynh_script_progression --message="Stopping Tvheadend service..." --weight=3
ynh_systemd_action --service_name=$app --action="stop"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
if ! ynh_permission_exists --permission="main"; then
# Create the required permissions
ynh_permission_create --permission="main" --allowed="visitors"
fi
#=================================================
# UPGRADE TVHEADEND DEB PACKAGE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
#=================================================
@ -116,7 +134,6 @@ then
fi
fi
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -125,26 +142,11 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
if ! ynh_permission_exists --permission="main"; then
# Create the required permissions
ynh_permission_create --permission="main" --allowed="visitors"
fi
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="TV streaming server and recorder" --needs_exposed_ports $port $stream_port
#=================================================
@ -157,6 +159,7 @@ ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# PREVENT TVHEADEND BEING UPGRADED THROUGHT APT
#=================================================
apt-mark hold tvheadend
#=================================================
@ -169,4 +172,4 @@ ynh_systemd_action --service_name=$app --action="start"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of Tvheadend completed, HTTP port is $port and HTSP port is $stream_port" --last
ynh_script_progression --message="Upgrade of Tvheadend completed, HTSP port is $stream_port" --last