Tighten the merged-/usr preinst check. Closes: #1076491.

This commit is contained in:
Helmut Grohne
2024-08-01 12:20:00 +02:00
committed by Santiago Vila
parent 34a8a4d648
commit e3b12aade1

20
debian/preinst vendored
View File

@@ -2,17 +2,29 @@
set -e
if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then
msg=
for d in bin lib lib32 lib64 libo32 lib64 sbin; do
if [ -d "$DPKG_ROOT/$d" ] && [ ! -L "$DPKG_ROOT/$d" ]; then
if [ -L "$DPKG_ROOT/$d" ]; then
if [ "$(readlink "$DPKG_ROOT/$d")" != "usr/$d" ]; then
msg="/$d is a symbolic link and not pointing at usr/$d exactly"
elif [ ! -d "$DPKG_ROOT/usr/$d" ]; then
msg="/$d is a dangling symbolic link"
fi
msg2="This is an unexpected situation. Cannot proceed with the upgrade"
elif [ -d "$DPKG_ROOT/$d" ]; then
msg="/$d is a directory, but should be a symbolic link"
msg2="Please install the usrmerge package to convert this system to merged-/usr"
fi
if [ -n "$msg" ]; then
cat <<EOF
******************************************************************************
*
* The base-files package cannot be installed because this system has a
* split /usr.
* The base-files package cannot be installed because
* $msg.
*
* Please install the usrmerge package to convert this system to merged-/usr.
* $msg2.
*
* For more information please read https://wiki.debian.org/UsrMerge.
*