Hi Sam,

Quoting Sam Hartman (2021-02-25 17:56:07)
> I'm setting a calendar note to come back tho this in May.
> Apologies for not having time sooner; I'm in the middle of planning for
> a move and trying to deal with bullseye issues.

I hope that everything went okay with your move and we can schedule a voice
call if you like. For me, evenings after 20:00 CEST would fit best.

We now have a set of scripts that patches src:pam (and others) to test the
DPKG_ROOT approach. We can now verify that creating a chroot that way results
in a bit-by-bit identical chroot compared to a chroot created the normal way:

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

In the process of getting that far we also extended the patch to src:pam.
Please find the patch attached.

Thanks!

cheers, josch
diff -Nru pam-1.4.0/debian/libpam-modules.postinst pam-1.4.0/debian/libpam-modules.postinst
--- pam-1.4.0/debian/libpam-modules.postinst	2021-01-30 23:09:52.000000000 +0100
+++ pam-1.4.0/debian/libpam-modules.postinst	2021-06-17 00:37:49.000000000 +0200
@@ -5,16 +5,16 @@

 if [ -z "$2" ] || dpkg --compare-versions "$2" lt 0.99.7.1-3
 then
-	if ! [ -f /etc/security/opasswd ]; then
+	if ! [ -f "$DPKG_ROOT/etc/security/opasswd" ]; then
 		umask 066
-		touch /etc/security/opasswd
+		touch "$DPKG_ROOT/etc/security/opasswd"
 		umask 022
 	fi
 fi

-if dpkg --compare-versions "$2" lt 0.99.9.0-1 && ! [ -f /etc/environment ]
+if dpkg --compare-versions "$2" lt 0.99.9.0-1 && ! [ -f "$DPKG_ROOT/etc/environment" ]
 then
-	touch /etc/environment
+	touch "$DPKG_ROOT/etc/environment"
 fi

 if dpkg --compare-versions "$2" lt-nl 1.1.2-1 \
diff -Nru pam-1.4.0/debian/libpam-runtime.postinst pam-1.4.0/debian/libpam-runtime.postinst
--- pam-1.4.0/debian/libpam-runtime.postinst	2021-01-30 23:09:52.000000000 +0100
+++ pam-1.4.0/debian/libpam-runtime.postinst	2021-06-17 00:37:49.000000000 +0200
@@ -8,7 +8,7 @@
 	sed -n -e'1,/# here are the per-package modules (the "Primary" block)/p;
 	          /# here.s the fallback if no module succeeds/,/# and here are more per-package modules (the "Additional" block)/p;
 	          /# end of pam-auth-update config/,$p' \
-	    /etc/pam.d/"$configfile" | md5sum | awk '{ print $1 }'
+	    "$DPKG_ROOT/etc/pam.d/$configfile" | md5sum | awk '{ print $1 }'
 }

 # If the user has removed the config file, respect this sign of dementia
@@ -20,26 +20,26 @@
 	for configfile in common-auth common-account common-session  \
 	    common-password
 	do
-		if [ -f /etc/pam.d/$configfile ] && \
+		if [ -f "$DPKG_ROOT/etc/pam.d/$configfile" ] && \
 		    ! fgrep -q $(calculate_md5sum $configfile) \
-		    /usr/share/pam/$configfile.md5sums 2>/dev/null
+		    "$DPKG_ROOT/usr/share/pam/$configfile.md5sums" 2>/dev/null
 		then
 			force=
 		fi
 	done
 fi

-pam-auth-update --package $force
+pam-auth-update --root "$DPKG_ROOT" --package $force

 if [ -n "$force" ]; then
-	rm -f /etc/pam.d/common-auth.pam-old \
-	      /etc/pam.d/common-account.pam-old \
-	      /etc/pam.d/common-password.pam-old \
-	      /etc/pam.d/common-session.pam-old
+	rm -f "$DPKG_ROOT/etc/pam.d/common-auth.pam-old" \
+	      "$DPKG_ROOT/etc/pam.d/common-account.pam-old" \
+	      "$DPKG_ROOT/etc/pam.d/common-password.pam-old" \
+	      "$DPKG_ROOT/etc/pam.d/common-session.pam-old"
 elif dpkg --compare-versions "$2" lt-nl 1.1.0-1 \
-        && [ ! -e /etc/pam.d/common-session-noninteractive ]
+        && [ ! -e "$DPKG_ROOT/etc/pam.d/common-session-noninteractive" ]
 then
-	cp -a /etc/pam.d/common-session /etc/pam.d/common-session-noninteractive
+	cp -a "$DPKG_ROOT/etc/pam.d/common-session" "$DPKG_ROOT/etc/pam.d/common-session-noninteractive"
 fi

 #DEBHELPER#
diff -Nru pam-1.4.0/debian/local/pam-auth-update pam-1.4.0/debian/local/pam-auth-update
--- pam-1.4.0/debian/local/pam-auth-update	2021-02-25 23:10:16.000000000 +0100
+++ pam-1.4.0/debian/local/pam-auth-update	2021-06-17 00:37:49.000000000 +0200
@@ -88,6 +88,11 @@
 		$force = 1;
 	} elsif ($opt eq '--package') {
 		$package = 1;
+	} elsif ($opt eq '--root') {
+		my $rootdir = shift @ARGV;
+		$savedir  = "$rootdir/$savedir";
+		$confdir  = "$rootdir/$confdir";
+		$inputdir = "$rootdir/$inputdir";
 	} elsif ($opt eq '--remove') {
 		while ($#ARGV >= 0) {
 			last if ($ARGV[0] =~ /^--/);

Attachment: signature.asc
Description: signature

Reply via email to