Skip to contentSkip to conversation

resolvconf: check if running systemd in postinst

PATCH In review Jonathan Liu 2 participants 2 messages Jul 8, 2013 – Jul 9, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 resolvconf: check if running systemd in postinst

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.

---
 meta/recipes-connectivity/resolvconf/resolvconf_1.73.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-connectivity/resolvconf/resolvconf_1.73.bb +1 -1
index ea5b6dd..c8f510b 100644
@@ -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
Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 5 lines · Jonathan Liu

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