diff --git a/scripts/install b/scripts/install index 08992e3..af74912 100644 --- a/scripts/install +++ b/scripts/install @@ -78,6 +78,9 @@ ynh_app_setting_set --app=$app --key=port --value=$port ynh_exec_fully_quiet yunohost firewall disallow Both 53 --no-reload ynh_exec_fully_quiet yunohost firewall allow Both 53 --no-upnp +# Open the UDP port 67 for dhcp +ynh_exec_fully_quiet yunohost firewall allow UDP 67 --no-upnp + #================================================= # INSTALL DEPENDENCIES #================================================= @@ -292,14 +295,6 @@ do echo "$localipv4 $perdomain #Added by pihole#" >> /etc/hosts done <<< "$(yunohost domain list | grep "\." | sed 's/.*: \|.*- //')" -#================================================= -# ENABLE DHCP SERVER -#================================================= -ynh_script_progression --message="Enabling DHCP server..." --weight=1 - -# Open the UDP port 67 for dhcp -ynh_exec_fully_quiet yunohost firewall allow UDP 67 --no-upnp - #================================================= # SET VERSIONS FOR THE FOOTER OF THE WEB INTERFACE #================================================= diff --git a/scripts/restore b/scripts/restore index 3e03d75..035e777 100644 --- a/scripts/restore +++ b/scripts/restore @@ -47,6 +47,26 @@ ynh_script_progression --message="Validating restoration parameters..." --weight test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " +#================================================= +# FIND AND OPEN A PORT +#================================================= +ynh_script_progression --message="Finding an available port..." --weight=12 + +# Find an available port +port=$(ynh_find_port --port=4711) +if [ $port -gt 4720 ] +then + ynh_die --message="The ports 4711 to 4720 are already in use. Pi-hole can't work on another port. Please try to free one of these ports." +fi +ynh_app_setting_set --app=$app --key=port --value=$port + +# Disable the port 53 for upnp +ynh_exec_fully_quiet yunohost firewall disallow Both 53 --no-reload +ynh_exec_fully_quiet yunohost firewall allow Both 53 --no-upnp + +# Open the UDP port 67 for dhcp +ynh_exec_fully_quiet yunohost firewall allow UDP 67 --no-upnp + #================================================= # ACTIVATE MAINTENANCE MODE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index cb33fa0..9a0a858 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -362,14 +362,6 @@ do echo "$localipv4 $perdomain #Added by pihole#" >> /etc/hosts done <<< "$(yunohost domain list | grep "\." | sed 's/.*: \|.*- //')" -#================================================= -# ENABLE DHCP SERVER -#================================================= -ynh_script_progression --message="Enabling DHCP server..." --weight=1 - -# Open the UDP port 67 for dhcp -ynh_exec_fully_quiet yunohost firewall allow UDP 67 --no-upnp - #================================================= # SET VERSIONS FOR THE FOOTER OF THE WEB INTERFACE #=================================================