1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rportd_ynh.git synced 2024-09-03 20:16:15 +02:00

More ports

This commit is contained in:
yalh76 2022-06-13 19:55:01 +02:00
parent 1b6e3fcad2
commit 3112dc3dfa
5 changed files with 20 additions and 6 deletions

View file

@ -101,7 +101,7 @@
## Defaults to ['20000-30000'].
## Example:
## used_ports = [ '1024-2000', '9000', '9090' ]
used_ports = ['20000-30000']
used_ports = ['__USED_START_PORT__-__USED_END_PORT__']
## Defines a list of port numbers or ranges of server ports,
## that would not be used for automatic and manual port assignment.

View file

@ -70,12 +70,18 @@ ynh_app_setting_set --app=$app --key=client_port --value=$client_port
ynh_script_progression --message="Configuring firewall..."
ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $client_port
api_port=$(ynh_find_port --port=8195)
api_port=$(ynh_find_port --port=$(($client_port + 1)))
ynh_app_setting_set --app=$app --key=api_port --value=$api_port
guacd_port=$(ynh_find_port --port=8295)
guacd_port=$(ynh_find_port --port=$(($api_port + 1)))
ynh_app_setting_set --app=$app --key=guacd_port --value=$guacd_port
used_start_port=$(ynh_find_port --port=20000)
ynh_app_setting_set --app=$app --key=used_start_port --value=$used_start_port
used_end_port=$(ynh_find_port --port=30000)
ynh_app_setting_set --app=$app --key=used_end_port --value=$used_end_port
ynh_exec_warn_less yunohost firewall allow TCP $used_start_port:$used_end_port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
@ -197,7 +203,7 @@ ynh_use_logrotate
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --log="/var/log/$app/$app.log" --needs_exposed_ports="$client_port"
yunohost service add $app --log="/var/log/$app/$app.log" --needs_exposed_ports="$client_port $used_start_port:$used_end_port"
#=================================================
# START SYSTEMD SERVICE

View file

@ -18,6 +18,8 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
client_port=$(ynh_app_setting_get --app=$app --key=client_port)
used_start_port=$(ynh_app_setting_get --app=$app --key=used_start_port)
used_end_port=$(ynh_app_setting_get --app=$app --key=used_end_port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
@ -106,6 +108,12 @@ then
ynh_exec_warn_less yunohost firewall disallow TCP $client_port
fi
if yunohost firewall list | grep -q "\- $used_start_port:$used_end_port$"
then
ynh_script_progression --message="Closing port $used_start_port:$used_end_port..."
ynh_exec_warn_less yunohost firewall disallow TCP $used_start_port:$used_end_port
fi
#=================================================
# SPECIFIC REMOVE
#=================================================

View file

@ -148,7 +148,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --log="/var/log/$app/$app.log" --needs_exposed_ports="$client_port"
yunohost service add $app --log="/var/log/$app/$app.log" --needs_exposed_ports="$client_port $used_start_port:$used_end_port"
#=================================================
# START SYSTEMD SERVICE

View file

@ -154,7 +154,7 @@ ynh_use_logrotate --non-append
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --log="/var/log/$app/$app.log" --needs_exposed_ports="$client_port"
yunohost service add $app --log="/var/log/$app/$app.log" --needs_exposed_ports="$client_port $used_start_port:$used_end_port"
#=================================================
# START SYSTEMD SERVICE