Package: base-files
Version: 13
Tags: patch moreinfo
X-Debbugs-Cc: [email protected]
Do not upload this patch to unstable yet!
Hi,
We are about to finalize the /usr-merge transition by moving all files
to their physical location. In the process, we want to move the actual
aliasing symbolic links from debootstrap/usrmerge into an actual
data.tar. The ideal package for this seems to be base-files. I've
prepared a patch for doing this.
I'll explain some of the choices made in the patch now as they may be
non-obvious.
* We're installing the aliasing symlinks as relative links despite
lintian complaining about this. The links that usrmerge and
debootstrap install are also relative and relative links make working
with chroots more convenient.
* base-files will "Provides: usr-is-merged". Future installations will
contain neither usrmerge nor a physical usr-is-merged package.
* base-files will install multilib directories when the dynamic loader
needs them. For instance on amd64, the dynamic loader path is
/lib64/ld-linux-x86-64.so.2. Therefore base-files:amd64 will include
/lib64. All other multilib directories will not be installed to
data.tar.
* For all non-essential multilib directoires, base-files declares a
trigger interest in the physical location and adds/removes the
aliasing symlink as-needed. This way, we do not have all of
lib32, lib64, libo32 and libx32 on every Debian installation.
* The patch proposed to glibc relies on these triggers to create these
multilib links for their multilib packages. If we change this aspect,
we must also change the glibc patch #1061248.
* base-files.preinst will now validate the aliasing symlinks as
usr-is-merged did. In a bootstrap setting, base-files is unpacked
before base-files.preinst and in an upgrade scenario we should be
merged already.
This patch needs to be uploaded concurrently with bash, dash, glibc and
util-linux failing to do so will break bootstrapping tools. I intend to
NMU this patch at an appropriate and coordinated time. I'm happy to
receive feedback on it already.
This mail is interesting to Julian, because he'll do the same changes to
Ubuntu just earlier than Debian. We're in the glad position that Ubuntu
will test this for us.
Helmut
--- a/debian/base-files.dirs
+++ b/debian/base-files.dirs
@@ -1,4 +1,3 @@
-bin
boot
dev
etc
@@ -8,19 +7,14 @@
etc/skel
etc/update-motd.d
home
-lib
proc
root
run
-sbin
sys
tmp
usr
-usr/bin
usr/games
usr/include
-usr/lib
-usr/sbin
usr/share
usr/share/base-files
usr/share/common-licenses
--- a/debian/base-files.lintian-overrides
+++ b/debian/base-files.lintian-overrides
base-files: extra-license-file [usr/share/common-licenses/LGPL-2]
base-files: extra-license-file [usr/share/common-licenses/LGPL-2.1]
base-files: extra-license-file [usr/share/common-licenses/LGPL-3]
+
+# Yes, these links really should be relative
+base-files: relative-symlink usr/bin [bin]
+base-files: relative-symlink usr/lib [lib]
+base-files: relative-symlink usr/lib64 [lib64]
+base-files: relative-symlink usr/libx32 [libx32]
+base-files: relative-symlink usr/sbin [sbin]
--- a/debian/clean
+++ b/debian/clean
@@ -1 +1,2 @@
debian/postinst
+debian/triggers
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@
Rules-Requires-Root: binary-targets
Package: base-files
-Provides: base
+Provides: base, usr-is-merged
Architecture: any
Pre-Depends: awk
Depends: ${misc:Depends}
--- a/debian/postinst.in
+++ b/debian/postinst.in
@@ -106,3 +106,15 @@
install_directory mnt 755 root
fi
fi
+
+if [ "$1" = triggered ]; then
+ for d in lib32 lib64 libo32 libx32; do
+ if test -d "$DPKG_ROOT/usr/$d"; then
+ test -h "$DPKG_ROOT/$d" && continue
+ ln -s "usr/$d" "$DPKG_ROOT/$d"
+ else
+ test -h "$DPKG_ROOT/$d" || continue
+ rm "$DPKG_ROOT/$d"
+ fi
+ done
+fi
--- a/debian/postrm
+++ b/debian/postrm
@@ -0,0 +1,13 @@
+#!/bin/sh
+set -e
+
+USR_MERGE="bin lib lib32 lib64 libo32 lib64 sbin"
+
+if [ "$1" = remove ]; then
+ for d in $USR_MERGE; do
+ # Remove DEP17 M4 protective diversions
+ dpkg-divert --quiet --package base-files --remove --no-rename --divert /$d.usr-is-merged /$d
+ done
+fi
+
+#DEBHELPER#
--- a/debian/preinst
+++ b/debian/preinst
@@ -0,0 +1,34 @@
+#!/bin/sh
+set -e
+
+USR_MERGE="bin lib lib32 lib64 libo32 lib64 sbin"
+
+if [ "$1" = install ] || [ "$1" = upgrade ]; then
+ for d in $USR_MERGE; do
+ if [ -d "$DPKG_ROOT/$d" ] && ! [ -h "$DPKG_ROOT/$d" ]; then
+ cat <<EOF
+
+
+******************************************************************************
+*
+* The base-files package cannot be installed because this system has a
+* split /usr.
+*
+* Please install the usrmerge package to convert this system to merged-/usr.
+*
+* For more information please read https://wiki.debian.org/UsrMerge.
+*
+******************************************************************************
+
+
+EOF
+ exit 1
+ fi
+ done
+ for d in $USR_MERGE; do
+ # Install DEP17 M4 protective diversions
+ dpkg-divert --quiet --package base-files --add --no-rename --divert /$d.usr-is-merged /$d
+ done
+fi
+
+#DEBHELPER#
--- a/debian/rules
+++ b/debian/rules
@@ -1,5 +1,7 @@
#!/usr/bin/make -f
+include /usr/share/dpkg/architecture.mk
+
OSNAME = "GNU/`uname | sed -e 's/GNU\///'`"
ifeq ($(DEB_HOST_GNU_SYSTEM),linux)
OSNAME=GNU/Linux
@@ -11,12 +13,28 @@
VENDORFILE = debian
DESTDIR = debian/base-files
+USR_MERGE = bin lib sbin
+ifneq (,$(filter $(DEB_HOST_ARCH),amd64 loong64 mips64el ppc64 ppc64el sparc64))
+USR_MERGE += lib64
+else ifneq (,$(filter $(DEB_HOST_ARCH),x32))
+USR_MERGE += libx32
+endif
+
%:
dh $@
override_dh_auto_build:
sh debian/check-md5sum-etc profile
sed -e "s/#VENDORFILE#/$(VENDORFILE)/g" debian/postinst.in > debian/postinst
+ set -e; { \
+ echo "# Triggers for creating multilib aliasing symlinks on demand"; \
+ for d in $(foreach d,lib32 lib64 libo32 libx32,$(if $(filter $(d),$(USR_MERGE)),,$(d))); do \
+ echo "interest-noawait $$d"; \
+ done; \
+ } > debian/triggers
+
+execute_after_dh_installdirs:
+ dh_installdirs $(foreach d,$(USR_MERGE),usr/$(d))
override_dh_auto_install:
install -p -m 644 etc/* $(DESTDIR)/etc
@@ -40,6 +58,8 @@
override_dh_link:
dh_link -X os-release
+ # We want these links to be relative, so we cannot use dh_link.
+ $(foreach d,$(USR_MERGE),ln -s usr/$(d) debian/base-files/$(d) &&) :
override_dh_compress:
dh_compress -X README