Bug#983412: libc-bin: please add support for DPKG_ROOT to the postinst
Package: libc-bin
Version: 2.31-9
Severity: wishlist
Tags: patch
User: debian-dpkg@lists.debian.org
Dear maintainers,
this is a followup on
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=910685
and makes libc-bin work with DPKG_ROOT set. Namely, the call to ldconfig
has to respect "$DPKG_ROOT" as it would otherwise attempt to modify the
real root instead of the new root directory.
Note, that this is again not a full solution because this will only work
when building a similar architecture chroot. It is still an improvement
of the status quo and having DPKG_ROOT work for same-architecture
chroots is already useful.
To test, I run:
mmdebstrap --mode=chrootless --variant=custom --include=bsdutils,coreutils,debianutils,diffutils,dpkg,findutils,grep,gzip,hostname,init-system-helpers,ncurses-base,ncurses-bin,perl-base,sed,tar,libc-bin unstable /dev/null
Without the patch this fails with:
ldconfig: Can't create temporary cache file /etc/ld.so.cache~: Permission denied
With the patch above command succeeds. The patch:
diff --git a/debian/debhelper.in/libc-bin.postinst b/debian/debhelper.in/libc-bin.postinst
index 802a3ad0..7fc320c5 100644
--- a/debian/debhelper.in/libc-bin.postinst
+++ b/debian/debhelper.in/libc-bin.postinst
@@ -40,15 +40,15 @@ update_to_current_default() {
}
if [ "$1" = "configure" ] && [ "$2" = "" ] ; then
- install_from_default /usr/share/libc-bin/nsswitch.conf /etc/nsswitch.conf
+ install_from_default "$DPKG_ROOT/usr/share/libc-bin/nsswitch.conf" "$DPKG_ROOT/etc/nsswitch.conf"
fi
if [ "$1" = "configure" ] && [ "$2" != "" ]; then
- update_to_current_default /usr/share/libc-bin/nsswitch.conf /etc/nsswitch.conf
+ update_to_current_default "$DPKG_ROOT/usr/share/libc-bin/nsswitch.conf" "$DPKG_ROOT/etc/nsswitch.conf"
fi
if [ "$1" = "triggered" ] || [ "$1" = "configure" ]; then
- ldconfig || ldconfig --verbose
+ ldconfig -r "$DPKG_ROOT/" || ldconfig --verbose -r "$DPKG_ROOT/"
exit 0
fi
Note, that adding DPKG_ROOT is not strictly necessary for
update_to_current_default because currently, DPKG_ROOT will only be used
for initial installations and not for upgrades.
Thanks!
cheers, josch
Reply to: