Patchwork resolvconf: check if running systemd in postinst

login
register
mail settings
Submitter Jonathan Liu
Date July 8, 2013, 1:31 p.m.
Message ID <1373290301-16657-1-git-send-email-net147@gmail.com>
Download mbox | patch
Permalink /patch/53325/
State Rejected, archived
Headers show

Comments

Jonathan Liu - July 8, 2013, 1:31 p.m.
Check if running systemd in postinst by testing for existence of
/sys/fs/cgroup/systemd instead of checking if systemd-tmpfiles
exists in PATH. This is so populate-volatile.sh update is called
instead of systemd-tmpfiles --create if the system has
systemd-tmpfiles installed but was booted using sysvinit.

Signed-off-by: Jonathan Liu <net147@gmail.com>
---
 meta/recipes-connectivity/resolvconf/resolvconf_1.73.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Ross Burton - July 9, 2013, 3:15 p.m.
On 8 July 2013 14:31, Jonathan Liu <net147@gmail.com> wrote:
> Check if running systemd in postinst by testing for existence of
> /sys/fs/cgroup/systemd instead of checking if systemd-tmpfiles
> exists in PATH. This is so populate-volatile.sh update is called
> instead of systemd-tmpfiles --create if the system has
> systemd-tmpfiles installed but was booted using sysvinit.

So this says to me that having two ways of creating files in volatile
locations is stupid.  Should we just split out populate-volatiles from
initscripts into it's own package so it can be used by pure systemd
images, and split out systemd-tmpfiles so it isn't enabled by default?
 This patch solves the issue for resolvconf but there are plenty of
other recipes that don't install files/postinst for both
populate-volatile and systemd-tmpfiles.

Ross

Patch

diff --git a/meta/recipes-connectivity/resolvconf/resolvconf_1.73.bb b/meta/recipes-connectivity/resolvconf/resolvconf_1.73.bb
index ea5b6dd..c8f510b 100644
--- a/meta/recipes-connectivity/resolvconf/resolvconf_1.73.bb
+++ b/meta/recipes-connectivity/resolvconf/resolvconf_1.73.bb
@@ -44,7 +44,7 @@  do_install () {
 
 pkg_postinst_${PN} () {
 	if [ -z "$D" ]; then
-		if command -v systemd-tmpfiles >/dev/null; then
+		if [ -e /sys/fs/cgroup/systemd ]; then
 			systemd-tmpfiles --create
 		elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
 			${sysconfdir}/init.d/populate-volatile.sh update