]> git.proxmox.com Git - pve-network.git/commitdiff
dnsmasq: check for existence of dnsmasq binary
authorStefan Hanreich <s.hanreich@proxmox.com>
Wed, 22 Nov 2023 18:33:47 +0000 (19:33 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 22 Nov 2023 18:45:52 +0000 (19:45 +0100)
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
src/PVE/Network/SDN/Dhcp/Dnsmasq.pm

index 58ce387ffd401352ca50b64caa46062b2f5f5c24..8b022fc83f4e097d0d689cd44ea772ac0667489b 100644 (file)
@@ -11,6 +11,8 @@ use PVE::Tools qw(file_set_contents run_command lock_file);
 use File::Copy;
 use Net::DBus;
 
+use PVE::RESTEnvironment qw(log_warn);
+
 my $DNSMASQ_CONFIG_ROOT = '/etc/dnsmasq.d';
 my $DNSMASQ_DEFAULT_ROOT = '/etc/default';
 my $DNSMASQ_LEASE_ROOT = '/var/lib/misc';
@@ -237,6 +239,12 @@ sub after_configure {
 sub before_regenerate {
     my ($class) = @_;
 
+    my $bin_path = "/usr/sbin/dnsmasq";
+    if (!-e $bin_path) {
+       log_warn("Please install dnsmasq in order to use the DHCP feature!");
+       die;
+    }
+
     PVE::Tools::run_command(['systemctl', 'stop', "dnsmasq@*"]);
     PVE::Tools::run_command(['systemctl', 'disable', 'dnsmasq@']);
 }