1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mumbleserver_ynh.git synced 2024-09-03 19:46:03 +02:00

mumble web: fix ports

make sure to use a dedicated port for web service, and to release it at removal
This commit is contained in:
Jibec 2020-04-10 14:11:36 +02:00
parent 6da29483ba
commit dd6e96a9cb
3 changed files with 17 additions and 2 deletions

View file

@ -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

View file

@ -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
#=================================================

View file

@ -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