From 09c6a9b51c3597f768e24f332f04c3a7f1242849 Mon Sep 17 00:00:00 2001 From: Davide Principi Date: Thu, 27 Jun 2024 14:13:25 +0200 Subject: [PATCH] Fix restart of dnsmasq.service in module update Even if the service is in failed state, a restart must be attempted. Skip the start/restart only if the service is disabled, typically because the module is still unconfigured. --- imageroot/update-module.d/10setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imageroot/update-module.d/10setup b/imageroot/update-module.d/10setup index e73eafa..a2f8c5b 100755 --- a/imageroot/update-module.d/10setup +++ b/imageroot/update-module.d/10setup @@ -15,5 +15,5 @@ mkdir -p dnsmasq.d dnsmasq_hosts.d # Install systemd service install -m 644 ../dnsmasq.service "/etc/systemd/system/${MODULE_ID}.service" systemctl daemon-reload -# restart service only if it's already running -systemctl try-restart "${MODULE_ID}" +# Restart the service, if the module has been configured: +systemctl -q is-enabled "${MODULE_ID}" && systemctl restart -T "${MODULE_ID}"