[OE-core] [PATCH] systemd.bbclass: restart service in postinst, not start

Ross Burton ross.burton at intel.com
Tue Apr 9 15:48:21 UTC 2013


When upgrading packages it's possible that the service is already running
because opkg doesn't actually execute the prerm hooks on upgrades, which is
where the service should be stopped.

Handle this case by restarting in postinst instead of starting.  If the service
isn't already running then this doesn't make a difference, but if it is running
then the service will be restarted.

[ YOCTO #4213 ]

Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/classes/systemd.bbclass |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index 69eeb9e..8084251 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -31,7 +31,7 @@ if type systemctl >/dev/null 2>/dev/null; then
 	systemctl $OPTS ${SYSTEMD_AUTO_ENABLE} ${SYSTEMD_SERVICE}
 
 	if [ -z "$D" -a "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
-		systemctl start ${SYSTEMD_SERVICE}
+		systemctl restart ${SYSTEMD_SERVICE}
 	fi
 fi
 }
-- 
1.7.10.4





More information about the Openembedded-core mailing list