summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schauer Marin Rodrigues <josch@debian.org>2022-08-21 05:49:05 +0200
committerJohannes Schauer Marin Rodrigues <josch@debian.org>2022-08-21 05:49:05 +0200
commit2f483abc00f5d86652e8c4c27648b870765235f9 (patch)
tree5c7aa9fe7c4e3897f6d5493141d62c8ff876bf2d
parentaaea83532018fe89291d612fb2ce17c53d557b38 (diff)
Only add --root option to systemd commands if DPKG_ROOT is set and not otherwise
Calling any systemd binaries with --root=/ is not a no-op. This is documented in the various man pages of the systemd tools: When this option is used, the libc Name Service Switch (NSS) is bypassed for resolving users and groups. Instead the files /etc/passwd and /etc/group inside the alternate root are read directly. This means that users/groups not listed in these files will not be resolved, i.e. LDAP NIS and other complex databases are not considered. or If this option is present, systemctl will operate on the file system directly, instead of communicating with the systemd daemon to carry out changes.
-rw-r--r--autoscripts/postinst-init-tmpfiles2
-rw-r--r--autoscripts/postinst-sysusers2
2 files changed, 2 insertions, 2 deletions
diff --git a/autoscripts/postinst-init-tmpfiles b/autoscripts/postinst-init-tmpfiles
index f56f3f97..d6bf0de1 100644
--- a/autoscripts/postinst-init-tmpfiles
+++ b/autoscripts/postinst-init-tmpfiles
@@ -1,3 +1,3 @@
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
- systemd-tmpfiles --root="$DPKG_ROOT/" --create #TMPFILES# >/dev/null || true
+ systemd-tmpfiles ${DPKG_ROOT:+--root="$DPKG_ROOT"} --create #TMPFILES# >/dev/null || true
fi
diff --git a/autoscripts/postinst-sysusers b/autoscripts/postinst-sysusers
index ea472946..fdd27d6d 100644
--- a/autoscripts/postinst-sysusers
+++ b/autoscripts/postinst-sysusers
@@ -1,3 +1,3 @@
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
- systemd-sysusers --root="${DPKG_ROOT}/" #CONFILE_BASENAME#
+ systemd-sysusers ${DPKG_ROOT:+--root="$DPKG_ROOT"} #CONFILE_BASENAME#
fi