From 409adb0c059da8e72436e2e0cb4fb3167d0eab7d Mon Sep 17 00:00:00 2001 From: glaszig Date: Wed, 26 Feb 2020 01:48:29 +0000 Subject: [PATCH] add conf-dir option to dnsmasq.conf, closes #403 this allows custom configuration stored in files in /etc/dnsmasq.d. raspap does not touch them and they'll always be loaded. also creates /etc/dnsmasq.d if it doesn't exist. --- includes/dhcp.php | 2 ++ installers/common.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/includes/dhcp.php b/includes/dhcp.php index d4525297..82d084d7 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -67,6 +67,8 @@ function DisplayDHCPConfig() $config .= PHP_EOL; } + $config .= "conf-dir=/etc/dnsmasq.d".PHP_EOL; + file_put_contents("/tmp/dnsmasqdata", $config); system('sudo cp /tmp/dnsmasqdata '.RASPI_DNSMASQ_CONFIG, $return); } else { diff --git a/installers/common.sh b/installers/common.sh index 74fee3e9..f0440d73 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -233,6 +233,8 @@ function default_configuration() { sudo cp $webroot_dir/config/dnsmasq.conf /etc/dnsmasq.conf || install_error "Unable to move dnsmasq configuration file" sudo cp $webroot_dir/config/dhcpcd.conf /etc/dhcpcd.conf || install_error "Unable to move dhcpcd configuration file" + [ -d /etc/dnsmasq.d ] || sudo mkdir /etc/dnsmasq.d + if [ ! -f "$webroot_dir/includes/config.php" ]; then sudo cp "$webroot_dir/config/config.php" "$webroot_dir/includes/config.php" fi