From dd6e96a9cbece1baac749436fa2368cf19a31929 Mon Sep 17 00:00:00 2001 From: Jibec Date: Fri, 10 Apr 2020 14:11:36 +0200 Subject: [PATCH] mumble web: fix ports make sure to use a dedicated port for web service, and to release it at removal --- scripts/install | 6 +++++- scripts/remove | 11 ++++++++++- scripts/upgrade | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 4c5efa4..d0c1566 100644 --- a/scripts/install +++ b/scripts/install @@ -24,7 +24,7 @@ ynh_abort_if_errors # Retrieve arguments domain=$YNH_APP_ARG_DOMAIN -path=$YNH_APP_ARG_PATH +path_url=$YNH_APP_ARG_PATH app=$YNH_APP_INSTANCE_NAME welcometext=$YNH_APP_ARG_WELCOMETEXT registerName=$YNH_APP_ARG_REGISTERNAME @@ -72,6 +72,8 @@ yunohost firewall allow Both "$port" if [ "$mumbleweb" -eq 1 ] ; then port_web=$(ynh_find_port 64738) ynh_app_setting_set "$app" port_web "$port_web" + # Open port in firewall + yunohost firewall allow Both "$port_web" fi #================================================= @@ -158,6 +160,8 @@ fi ynh_add_systemd_config if [ "$mumbleweb" -eq 1 ] ; then + ynh_replace_string "__PORT__" "$port" "../conf/mumble-web.service" + ynh_replace_string "__PORT_WEB__" "$port_web" "../conf/mumble-web.service" ynh_add_systemd_config "$app-web" mumble-web.service fi diff --git a/scripts/remove b/scripts/remove index 234499b..de8e1fc 100644 --- a/scripts/remove +++ b/scripts/remove @@ -18,8 +18,9 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) port=$(ynh_app_setting_get "$app" port) +port_web=$(ynh_app_setting_get "$app" port_web) +mumbleweb=$(ynh_app_setting_get "$app" mumbleweb) final_path=$(ynh_app_setting_get "$app" final_path) - #================================================= # STANDARD REMOVE #================================================= @@ -78,6 +79,14 @@ then yunohost firewall disallow Both "$port" > /dev/null 2>&1 fi +if [ "$mumbleweb" -eq 1 ] ; then + if yunohost firewall list | grep -q "\- $port_web$" + then + echo "Close port $port_web" + yunohost firewall disallow Both "$port_web" > /dev/null 2>&1 + fi +fi + #================================================= # SPECIFIC REMOVE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 46fef48..3adcb12 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -202,6 +202,8 @@ ynh_script_progression --message="Upgrading systemd configuration..." --time --w ynh_add_systemd_config if [ "$mumbleweb" -eq 1 ] ; then + ynh_replace_string "__PORT__" "$port" "../conf/mumble-web.service" + ynh_replace_string "__PORT_WEB__" "$port_web" "../conf/mumble-web.service" ynh_add_systemd_config "$app-web" mumble-web.service fi