Hi,

Quoting Santiago Vila (2022-01-19 22:15:44)
> El 19/1/22 a las 22:09, Johannes Schauer Marin Rodrigues escribió:
> > Quoting Johannes Schauer Marin Rodrigues (2021-10-23 11:08:56)
> >> I just wanted to send a friendly ping about DPKG_ROOT support of 
> >> base-files.
> >> I hope that I was able to address all your questions in my last mail to 
> >> this
> >> bug.  If there is anything else I can do to help you?
> > since your last activity on this bug was more than 100 days ago, I uploaded
> > a NMU of base-files with the attached debdiff to DELAYED/10. As usual feel
> > free to cancel the NMU (or tell me to cancel it) if you disagree with my
> > upload.
> Well, this NMU is hostile and unwelcome because this is not an important or
> serious bug (which is what NMUs are for).
> 
> Please cancel the NMU.

Done.

Files removed from 10-day: base-files_12+nmu1_source.changes 
base-files_12+nmu1.dsc base-files_12+nmu1.tar.xz
base-files_12+nmu1_amd64.buildinfo

If my NMU offended you, then I'm sorry. It was not my intention to offend you.

> There is one thing which I really dislike about the proposed change, which is
> the fact that you are trying to support *broken* Debian systems (namely,
> those having /etc/passwd with different UID than the target system). No, I
> don't think we should support broken systems. Broken systems should be fixed
> first before doing any development with them.

Understood. Then let me scale back the patch a bit more. Now the attached patch
uses /etc/passwd from the outside system and thus uses plain chown calls.

Is that something you'd be willing to apply?

Thanks!

cheers, josch
diff -Nru base-files-12/debian/changelog base-files-12+nmu1/debian/changelog
--- base-files-12/debian/changelog	2021-08-22 19:00:00.000000000 +0200
+++ base-files-12+nmu1/debian/changelog	2022-01-19 21:49:23.000000000 +0100
@@ -1,3 +1,10 @@
+base-files (12+nmu1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Add support for DPKG_ROOT to postinst. Closes: #824594
+
+ -- Johannes Schauer Marin Rodrigues <jo...@debian.org>  Wed, 19 Jan 2022 21:49:23 +0100
+
 base-files (12) unstable; urgency=medium
 
   * Do not create /var/run/utmp in postinst, as /var/run is
diff -Nru base-files-12/debian/postinst.in base-files-12+nmu1/debian/postinst.in
--- base-files-12/debian/postinst.in	2021-08-22 19:00:00.000000000 +0200
+++ base-files-12+nmu1/debian/postinst.in	2022-01-19 21:49:23.000000000 +0100
@@ -2,51 +2,51 @@
 set -e
 
 install_local_dir() {
-  if [ ! -d $1 ]; then
-    mkdir -p $1
+  if [ ! -d "$DPKG_ROOT$1" ]; then
+    mkdir -p "$DPKG_ROOT$1"
   fi
-  if [ -f /etc/staff-group-for-usr-local ]; then
-    chown root:staff $1 2> /dev/null || true
-    chmod 2775 $1 2> /dev/null || true
+  if [ -f "$DPKG_ROOT/etc/staff-group-for-usr-local" ]; then
+    chown root:staff "$DPKG_ROOT$1" 2>/dev/null || true
+    chmod 2775 "$DPKG_ROOT$1" 2> /dev/null || true
   fi
 }
 
 install_from_default() {
-  if [ ! -f $2 ]; then
-    cp -p /usr/share/base-files/$1 $2
+  if [ ! -f "$DPKG_ROOT$2" ]; then
+    cp -p "$DPKG_ROOT/usr/share/base-files/$1" "$DPKG_ROOT$2"
   fi
 }
 
 install_directory() {
-  if [ ! -d /$1 ]; then
-    mkdir /$1
-    chown root:$3 /$1
-    chmod $2 /$1
+  if [ ! -d "$DPKG_ROOT/$1" ]; then
+    mkdir "$DPKG_ROOT/$1"
+    chown "root:$3" "$DPKG_ROOT/$1"
+    chmod "$2" "$DPKG_ROOT/$1"
   fi
 }
 
 migrate_directory() {
-  if [ ! -L $1 ]; then
-    rmdir $1
-    ln -s $2 $1
+  if [ ! -L "$DPKG_ROOT$1" ]; then
+    rmdir "$DPKG_ROOT$1"
+    ln -s "$2" "$DPKG_ROOT$1"
   fi
 }
 
 update_to_current_default() {
-  if [ -f $2 ]; then
-    md5=`md5sum $2 | cut -f 1 -d " "`
-    if grep -q "$md5" /usr/share/base-files/$1.md5sums; then
-      if ! cmp -s /usr/share/base-files/$1 $2; then
-        cp -p /usr/share/base-files/$1 $2
+  if [ -f "$2" ]; then
+    md5=`md5sum "$2" | cut -f 1 -d " "`
+    if grep -q "$md5" "/usr/share/base-files/$1.md5sums"; then
+      if ! cmp -s "/usr/share/base-files/$1" "$2"; then
+        cp -p "/usr/share/base-files/$1" "$2"
         echo Updating $2 to current default.
       fi
     fi
   fi
 }
 
-if [ ! -e /etc/dpkg/origins/default ]; then
-  if [ -e /etc/dpkg/origins/#VENDORFILE# ]; then
-    ln -sf #VENDORFILE# /etc/dpkg/origins/default
+if [ ! -e "$DPKG_ROOT/etc/dpkg/origins/default" ]; then
+  if [ -e "$DPKG_ROOT/etc/dpkg/origins/#VENDORFILE#" ]; then
+    ln -sf #VENDORFILE# "$DPKG_ROOT/etc/dpkg/origins/default"
   fi
 fi
 
@@ -62,8 +62,8 @@
   install_directory var/opt   755 root
   install_directory media     755 root
   install_directory var/mail 2775 mail
-  if [ ! -L /var/spool/mail ]; then
-    ln -s ../mail /var/spool/mail
+  if [ ! -L "$DPKG_ROOT/var/spool/mail" ]; then
+    ln -s ../mail "$DPKG_ROOT/var/spool/mail"
   fi
   install_directory run/lock 1777 root
   migrate_directory /var/run /run
@@ -79,25 +79,25 @@
   install_local_dir /usr/local/sbin
   install_local_dir /usr/local/src
   install_local_dir /usr/local/etc
-  ln -sf share/man /usr/local/man
+  ln -sf share/man "$DPKG_ROOT/usr/local/man"
 
-  if [ ! -f /var/log/wtmp ]; then
-    echo -n>/var/log/wtmp
+  if [ ! -f "$DPKG_ROOT/var/log/wtmp" ]; then
+    echo -n>"$DPKG_ROOT/var/log/wtmp"
   fi
-  if [ ! -f /var/log/btmp ]; then
-    echo -n>/var/log/btmp
+  if [ ! -f "$DPKG_ROOT/var/log/btmp" ]; then
+    echo -n>"$DPKG_ROOT/var/log/btmp"
   fi
-  if [ ! -f /var/log/lastlog ]; then
-    echo -n>/var/log/lastlog
+  if [ ! -f "$DPKG_ROOT/var/log/lastlog" ]; then
+    echo -n>"$DPKG_ROOT/var/log/lastlog"
   fi
-  chown root:utmp /var/log/wtmp /var/log/btmp /var/log/lastlog
-  chmod 664 /var/log/wtmp /var/log/lastlog
-  chmod 660 /var/log/btmp
+  chown root:utmp "$DPKG_ROOT/var/log/wtmp" "$DPKG_ROOT/var/log/btmp" "$DPKG_ROOT/var/log/lastlog"
+  chmod 664 "$DPKG_ROOT/var/log/wtmp" "$DPKG_ROOT/var/log/lastlog"
+  chmod 660 "$DPKG_ROOT/var/log/btmp"
 fi
 
-if [ -d /usr/share/info ] && [ ! -f /usr/info/dir ] && [ ! -f /usr/share/info/dir ]; then
+if [ -d "$DPKG_ROOT/usr/share/info" ] && [ ! -f "$DPKG_ROOT/usr/info/dir" ] && [ ! -f "$DPKG_ROOT/usr/share/info/dir" ]; then
   install_from_default info.dir /usr/share/info/dir
-  chmod 644 /usr/share/info/dir
+  change_mode 644 /usr/share/info/dir
 fi
 
 if [ "$1" = "configure" ] && [ "$2" != "" ]; then

Attachment: signature.asc
Description: signature

Reply via email to