From f17b902a16d9ee169be8eda7d4fba85658a958e2 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 6 Jun 2023 16:47:00 +0200 Subject: [run-virt] Don't run DHCPd config generator/restarter unless we support running VMs at all --- core/modules/run-virt/data/opt/openslx/scripts/runvirt-start_dhcpd | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'core/modules/run-virt/data/opt/openslx') diff --git a/core/modules/run-virt/data/opt/openslx/scripts/runvirt-start_dhcpd b/core/modules/run-virt/data/opt/openslx/scripts/runvirt-start_dhcpd index 60cf7333..99320dd6 100755 --- a/core/modules/run-virt/data/opt/openslx/scripts/runvirt-start_dhcpd +++ b/core/modules/run-virt/data/opt/openslx/scripts/runvirt-start_dhcpd @@ -1,5 +1,8 @@ #!/bin/bash +# If this doesn't exist, we don't support running VMs, so this is pointless +[ -s /opt/openslx/vmchooser/config/virtualization.conf ] || exit 0 + . /opt/openslx/config . /opt/openslx/vmchooser/config/virtualization.conf @@ -59,8 +62,9 @@ elif [ -s "${DHCP_NAT_CONF}" ] && [ "${DHCP_NAT_CONF}.$$" -ot "${DHCP_NAT_CONF}" rm -f -- "${DHCP_NAT_CONF}.$$" else # Changed, replace and restart - mv -f -- "${DHCP_NAT_CONF}.$$" "${DHCP_NAT_CONF}" echo "NAT1 dhcpd config changed; restarting service..." + diff -u "${DHCP_NAT_CONF}" "${DHCP_NAT_CONF}.$$" + mv -f -- "${DHCP_NAT_CONF}.$$" "${DHCP_NAT_CONF}" systemctl --no-block try-restart run-virt-dhcpd.service fi -- cgit v1.2.3-55-g7522