diff --git a/conf/pihole-FTL.conf b/conf/pihole-FTL.conf index 869f50c..473ca7f 100644 --- a/conf/pihole-FTL.conf +++ b/conf/pihole-FTL.conf @@ -2,6 +2,9 @@ ; localonly|all SOCKET_LISTENING=localonly +; On which port should FTL be listening? +FTLPORT=__PORT__ + ; Display all queries? Set to no to hide query display ; yes|no QUERY_DISPLAY=yes diff --git a/scripts/actions/reset_default_config b/scripts/actions/reset_default_config index 058d735..fcec8b7 100755 --- a/scripts/actions/reset_default_config +++ b/scripts/actions/reset_default_config @@ -70,7 +70,8 @@ then elif [ "$file" = "pihole-FTL.conf" ] then # Get the default file and overwrite the current config - cp /etc/yunohost/apps/$app/conf/pihole-FTL.conf "$config_file" + port=$(ynh_app_setting_get --app=$app --key=port) + ynh_add_config --template="/etc/yunohost/apps/$app/conf/pihole-FTL.conf" --destination="$config_file" ynh_script_progression --message="Restarting Pi-Hole..." --weight=2 diff --git a/scripts/install b/scripts/install index dd93984..9c3c494 100644 --- a/scripts/install +++ b/scripts/install @@ -74,10 +74,6 @@ 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_script_progression --message="Configuring firewall..." --weight=1 -# Open this port -ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP $port ynh_app_setting_set --app=$app --key=port --value=$port # Disable the port 53 for upnp @@ -230,10 +226,8 @@ ynh_exec_warn_less make install ) ynh_secure_remove --file="$FTL_temp_path" cp "../conf/dns-servers.conf" "$pihole_storage" -cp "../conf/pihole-FTL.conf" "$pihole_storage" -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$pihole_storage/pihole-FTL.conf" +ynh_add_config --template="../conf/pihole-FTL.conf" --destination="$pihole_storage/pihole-FTL.conf" if [ "$pihole_version" == "Last 3.X" ] then diff --git a/scripts/remove b/scripts/remove index fc85080..b9e9537 100755 --- a/scripts/remove +++ b/scripts/remove @@ -109,7 +109,7 @@ ynh_remove_fpm_config #================================================= # CLOSE PORTS #================================================= -ynh_script_progression --message="Closing ports $port et 67..." --weight=13 +ynh_script_progression --message="Closing ports $port and 67..." --weight=13 if yunohost firewall list | grep -q "\- $port$" then diff --git a/scripts/upgrade b/scripts/upgrade index 1a63b65..eea787a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -265,11 +265,7 @@ fi # Overwrite pihole-FTL config file only if it's allowed if [ $overwrite_ftl -eq 1 ] then - # Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. - ynh_backup_if_checksum_is_different --file="$pihole_storage/pihole-FTL.conf" - cp "../conf/pihole-FTL.conf" "$pihole_storage" - # Recalculate and store the checksum of the file for the next upgrade. - ynh_store_file_checksum --file="$pihole_storage/pihole-FTL.conf" + ynh_add_config --template="../conf/pihole-FTL.conf" --destination="$pihole_storage/pihole-FTL.conf" fi if [ "$pihole_version" == "Last 3.X" ]