[Pkg-shadow-devel] Bug#992578: login: please add support for DPKG_ROOT

Johannes Schauer Marin Rodrigues josch at debian.org
Fri Aug 20 13:15:59 BST 2021


Package: login
Version: 1:4.8.1-1
Severity: normal
Tags: patch
User: debian-dpkg at lists.debian.org
Usertags: dpkg-root-support
Control: block -1 by 989712

Hi,

We're working on a way to install packages into a chroot without
actually using the chroot system call. A consequence of doing so is that
maintainer scripts are run outside the chroot and are supposed to still
operate on the chroot whose location is communicated via the DPKG_ROOT
environment variable.

We have created a salsaci job which patches 13 source packages,
including src:shadow and shows that a chroot-tarball created that way is
bit-by-bit identical to a chroot-tarball created the normal way:

https://salsa.debian.org/helmutg/dpkg-root-demo/-/jobs

The necessary changes to src:shadow can be found in bug #989712 as well
as in the patch at the end of this mail.

Thanks!

cheers, josch

--- a/debian/login.postinst
+++ b/debian/login.postinst
@@ -4,23 +4,23 @@
 
 if [ "$1" = "configure" ]; then
 	# Install faillog during initial installs only
-	if [ "$2" = "" ] && [ ! -f /var/log/faillog ] ; then
-		touch /var/log/faillog
-		chown root:root /var/log/faillog
-		chmod 644 /var/log/faillog
+	if [ "$2" = "" ] && [ ! -f "$DPKG_ROOT/var/log/faillog" ] ; then
+		touch "$DPKG_ROOT/var/log/faillog"
+		chown 0:0 "$DPKG_ROOT/var/log/faillog"
+		chmod 644 "$DPKG_ROOT/var/log/faillog"
 	fi

 	# Create subuid/subgid if missing
-	if [ ! -e /etc/subuid ]; then
-		touch /etc/subuid
-		chown root:root /etc/subuid
-		chmod 644 /etc/subuid
+	if [ ! -e "$DPKG_ROOT/etc/subuid" ]; then
+		touch "$DPKG_ROOT/etc/subuid"
+		chown 0:0 "$DPKG_ROOT/etc/subuid"
+		chmod 644 "$DPKG_ROOT/etc/subuid"
 	fi

-	if [ ! -e /etc/subgid ]; then
-		touch /etc/subgid
-		chown root:root /etc/subgid
-		chmod 644 /etc/subgid
+	if [ ! -e "$DPKG_ROOT/etc/subgid" ]; then
+		touch "$DPKG_ROOT/etc/subgid"
+		chown 0:0 "$DPKG_ROOT/etc/subgid"
+		chmod 644 "$DPKG_ROOT/etc/subgid"
 	fi
 fi
 



More information about the Pkg-shadow-devel mailing list