DEP17: Install /usr-merge aliasing symlinks. Closes: #1064459.

This commit is contained in:
Helmut Grohne
2024-06-06 17:20:21 +02:00
committed by Santiago Vila
parent d888609a41
commit 0f4e218448
8 changed files with 107 additions and 8 deletions
-6
View File
@@ -1,4 +1,3 @@
bin
boot
dev
etc
@@ -8,19 +7,14 @@ etc/profile.d
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
+13
View File
@@ -20,3 +20,16 @@ base-files: extra-license-file [usr/share/common-licenses/GPL-3]
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]
#
# 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]
#
# We need these for the relevant architectures.
#
base-files: non-multi-arch-lib-dir [usr/lib64/]
base-files: non-multi-arch-lib-dir [usr/libx32/]
+1
View File
@@ -0,0 +1 @@
debian/triggers
+1 -1
View File
@@ -7,7 +7,7 @@ Build-Depends: debhelper-compat (= 13), debhelper (>= 13.10~)
Rules-Requires-Root: binary-targets
Package: base-files
Provides: base
Provides: base, usr-is-merged
Architecture: any
Pre-Depends: awk
Depends: ${misc:Depends}
+22
View File
@@ -108,4 +108,26 @@ if [ "$1" = "configure" ] && [ "$2" != "" ]; then
fi
fi
rtlddir="#USR_MERGE_RTLDLIB#"
if [ "$1" = "configure" ] && [ -n "$rtlddir" ]; then
# Remove temporary DEP17 M4 diversion added by glibc.
dpkg-divert --quiet --package base-files --remove --no-rename --divert "/.$rtlddir.usr-is-merged" "/$rtlddir"
fi
if [ "$1" = "configure" ] || [ "$1" = "triggered" ]; then
for d in #USR_MERGE_MULTILIB#; do
if [ -d "$DPKG_ROOT/usr/$d" ]; then
if [ -L "$DPKG_ROOT/$d" ]; then
:
elif [ -d "$DPKG_ROOT/$d" ]; then
echo "Warning: /$d is not a symlink, but should be." 1>&2
else
ln -s "usr/$d" "$DPKG_ROOT/$d"
fi
elif [ -L "$DPKG_ROOT/$d" ]; then
rm "$DPKG_ROOT/$d"
fi
done
fi
#DEBHELPER#
+11
View File
@@ -0,0 +1,11 @@
#!/bin/sh
set -e
if [ "$1" = "remove" ]; then
for d in #USR_MERGE_MULTILIB#; do
# Remove DEP17 M4 protective diversions
dpkg-divert --quiet --package base-files --remove --no-rename --divert "/.$d.usr-is-merged" "/$d"
done
fi
#DEBHELPER#
+32
View File
@@ -0,0 +1,32 @@
#!/bin/sh
set -e
if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then
for d in bin lib lib32 lib64 libo32 lib64 sbin; do
if [ -d "$DPKG_ROOT/$d" ] && [ ! -L "$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_MULTILIB#; do
# Install DEP17 M4 protective diversions
dpkg-divert --quiet --package base-files --add --no-rename --divert "/.$d.usr-is-merged" "/$d"
done
fi
#DEBHELPER#
+27 -1
View File
@@ -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,6 +13,14 @@ endif
VENDORFILE = debian
DESTDIR = debian/base-files
ifneq (,$(filter $(DEB_HOST_ARCH),amd64 loong64 mips64el ppc64 ppc64el sparc64))
USR_MERGE_RTLDLIB = lib64
else ifneq (,$(filter $(DEB_HOST_ARCH),x32))
USR_MERGE_RTLDLIB = libx32
endif
USR_MERGE = bin lib sbin $(USR_MERGE_RTLDLIB)
USR_MERGE_MULTILIB = $(filter-out $(USR_MERGE),lib32 lib64 libo32 libx32)
%:
dh $@
@@ -19,6 +29,15 @@ execute_after_dh_clean:
override_dh_auto_build:
sh debian/check-md5sum-etc profile
set -e; { \
echo "# Triggers for creating multilib aliasing symlinks on demand"; \
for d in $(USR_MERGE_MULTILIB); do \
echo "interest-noawait /usr/$$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
@@ -42,6 +61,10 @@ override_dh_installchangelogs:
override_dh_link:
dh_link -X os-release
# We want these links to be relative, so we cannot use dh_link.
set -e; for d in $(USR_MERGE); do \
ln -s usr/$$d debian/base-files/$$d; \
done
override_dh_compress:
dh_compress -X README
@@ -55,4 +78,7 @@ override_dh_fixperms:
cd debian/base-files && chmod 700 root
override_dh_installdeb:
dh_installdeb -DVENDORFILE=$(VENDORFILE)
dh_installdeb \
'-DVENDORFILE=$(VENDORFILE)' \
'-DUSR_MERGE_MULTILIB=$(USR_MERGE_MULTILIB)' \
'-DUSR_MERGE_RTLDLIB=$(USR_MERGE_RTLDLIB)'