diff --git a/conf/dnsmasq_regenconf_hook b/conf/dnsmasq_regenconf_hook index b54edfd..f9341bf 100755 --- a/conf/dnsmasq_regenconf_hook +++ b/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" diff --git a/scripts/install b/scripts/install index 6df124b..0450562 100644 --- a/scripts/install +++ b/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