Patchwork [5/6] systemd: pass --root in prerm if running on host

login
register
mail settings
Submitter Ross Burton
Date Dec. 18, 2013, 4:20 p.m.
Message ID <1387383607-4005-5-git-send-email-ross.burton@intel.com>
Download mbox | patch
Permalink /patch/63535/
State New
Headers show

Comments

Ross Burton - Dec. 18, 2013, 4:20 p.m.
If a systemd image is built without a package manager then packages will be
removed from an image during rootfs generation, but without passing --root the
systemctl will look on the *host* system.

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

Patch

diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index efc1adc..2bd63a4 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -38,12 +38,18 @@  fi
 }
 
 systemd_prerm() {
+OPTS=""
+
+if [ -n "$D" ]; then
+    OPTS="--root=$D"
+fi
+
 if type systemctl >/dev/null 2>/dev/null; then
 	if [ -z "$D" ]; then
 		systemctl stop ${SYSTEMD_SERVICE}
 	fi
 
-	systemctl disable ${SYSTEMD_SERVICE}
+	systemctl $OPTS disable ${SYSTEMD_SERVICE}
 fi
 }