]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
systemd.bbclass: update command to check systemctl available
authorKai Kang <kai.kang@windriver.com>
Wed, 2 Dec 2020 02:21:45 +0000 (10:21 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 6 Dec 2020 23:16:50 +0000 (23:16 +0000)
When use a core image with systemd as docker image, it fails to
install/remove package which calls systemctl in post scripts.
It fails to run systemctl in a container:

bash-5.0# systemctl
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

So replace the criterion command 'type systemctl' with 'systemctl' in
package post scripts to check whether systemctl available.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/systemd.bbclass

index 9e8a82c9f170f2f4bd618896c9dccfc1754521aa..9ec465c75934b5e64bef23a88d8b862be0dd8148 100644 (file)
@@ -23,7 +23,7 @@ python __anonymous() {
 }
 
 systemd_postinst() {
-if type systemctl >/dev/null 2>/dev/null; then
+if systemctl >/dev/null 2>/dev/null; then
        OPTS=""
 
        if [ -n "$D" ]; then
@@ -48,7 +48,7 @@ fi
 }
 
 systemd_prerm() {
-if type systemctl >/dev/null 2>/dev/null; then
+if systemctl >/dev/null 2>/dev/null; then
        if [ -z "$D" ]; then
                systemctl stop ${SYSTEMD_SERVICE_ESCAPED}