From: "kai" <kai.kang@windriver.com>
To: obi@opendreambox.org
Cc: openembedded-core@lists.openembedded.org
Subject: [PATCH 2/2] systemd.bbclass: check whether systemctl works in post scripts
Date: Mon, 2 Nov 2020 10:17:57 +0800 [thread overview]
Message-ID: <20201102021757.32532-3-kai.kang@windriver.com> (raw)
In-Reply-To: <20201102021757.32532-1-kai.kang@windriver.com>
From: Kai Kang <kai.kang@windriver.com>
When use a core image tarball as a docker image with 'docker import', it
fails to install/remove package which calls systemctl in post scripts
that 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
Replace 'type systemctl' with call 'systemctl' directly in package post
scripts to check whether systemctl works rather than existence.
Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
meta/classes/systemd.bbclass | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index 9e8a82c9f1..9ec465c759 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -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}
--
2.17.1
next prev parent reply other threads:[~2020-11-02 2:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-02 2:17 [PATCH 0/2] Update check for systemctl kai
2020-11-02 2:17 ` [PATCH 1/2] systemd-systemctl: capable to call without argument kai
2020-11-02 2:17 ` kai [this message]
[not found] ` <16438F587D21D644.10137@lists.openembedded.org>
2020-11-17 2:14 ` [OE-core] " kai
2020-11-23 10:59 ` kai
2020-11-20 2:03 ` kai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201102021757.32532-3-kai.kang@windriver.com \
--to=kai.kang@windriver.com \
--cc=obi@opendreambox.org \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox