Browse Source

use the template version of 01-pihole.conf

Kay0u 4 years ago
parent
commit
57c86aaa15
2 changed files with 14 additions and 4 deletions
  1. 14 1
      conf/dnsmasq_regenconf_hook
  2. 0 3
      scripts/install

+ 14 - 1
conf/dnsmasq_regenconf_hook

@@ -14,7 +14,20 @@ do_pre_regen() {
         mkdir -p "$dnsmasq_dir"
         cp -a "/etc/dnsmasq.conf" "${pending_conf}/etc/dnsmasq.conf"
         # Créer une sauvegarde des config dnsmasq de pi-hole. Que la regen-conf va sauvagement supprimer
-        cp -a "/etc/dnsmasq.d/01-pihole.conf" "$dnsmasq_dir/"
+        cp -a "/etc/.pihole/advanced/01-pihole.conf" "$dnsmasq_dir/"
+        ynh_replace_string --match_string="@DNS1@" --replace_string="" --target_file="$dnsmasq_dir/01-pihole.conf"
+        ynh_replace_string --match_string="@DNS2@" --replace_string="" --target_file="$dnsmasq_dir/01-pihole.conf"
+        ynh_replace_string --match_string="^no-resolv" --replace_string="#no-resolv" --target_file="$dnsmasq_dir/01-pihole.conf"
+
+        ynh_replace_string --match_string="@INT@" --replace_string="$main_iface" --target_file="$dnsmasq_dir/01-pihole.conf"
+        if [ "$query_logging" = "true" ]; then
+            ynh_replace_string --match_string="^#log-queries" --replace_string="log-queries" --target_file="$dnsmasq_dir/01-pihole.conf"
+        else
+            ynh_replace_string --match_string="^log-queries" --replace_string="#log-queries" --target_file="$dnsmasq_dir/01-pihole.conf"
+        fi
+
+        # Fix a too recent option for our dnsmasq version.
+        ynh_replace_string --match_string="log-queries=extra" --replace_string="log-queries" --target_file="$dnsmasq_dir/01-pihole.conf"
 
         ynh_replace_string --match_string="^cache-size=" --replace_string="#pihole# cache-size=" --target_file="${pending_conf}/etc/dnsmasq.conf"
 

+ 0 - 3
scripts/install

@@ -314,9 +314,6 @@ fi
 # Fix a too recent option for our dnsmasq version.
 ynh_replace_string --match_string="log-queries=extra" --replace_string="log-queries" --target_file=$pihole_dnsmasq_config
 
-# Calculate and store the config file checksum into the app settings
-ynh_store_file_checksum --file="$pihole_dnsmasq_config"
-
 # To prevent any conflict with the original dnsmasq config, comment cache-size in the original config.
 ynh_replace_string --match_string="^cache-size=" --replace_string="#pihole# cache-size=" --target_file=/etc/dnsmasq.conf