summaryrefslogtreecommitdiffstats
path: root/debian/systemd.preinst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:49:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:49:53 +0000
commit87aefc960557c2fb6fdf9ea4c1ac0e7983f68f68 (patch)
tree263fc56d7d40512aaa09193905008a3f4e3b0018 /debian/systemd.preinst
parentAdding upstream version 255.4. (diff)
downloadsystemd-87aefc960557c2fb6fdf9ea4c1ac0e7983f68f68.tar.xz
systemd-87aefc960557c2fb6fdf9ea4c1ac0e7983f68f68.zip
Adding debian version 255.4-1.debian/255.4-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/systemd.preinst')
-rw-r--r--debian/systemd.preinst57
1 files changed, 57 insertions, 0 deletions
diff --git a/debian/systemd.preinst b/debian/systemd.preinst
new file mode 100644
index 0000000..67c1304
--- /dev/null
+++ b/debian/systemd.preinst
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+set -e
+
+is_merged() {
+ local directories="/bin /sbin /lib"
+ for dir in $directories; do
+ [ -e "$DPKG_ROOT$dir" ] || continue
+ [ "$(readlink -f "$DPKG_ROOT$dir")" = "$DPKG_ROOT/usr$dir" ] || return 1
+ done
+
+ # Avoid an exact match, as the target might vary depending on the tool
+ # building the image. For example, systemd-nspawn links /lib64 to
+ # /usr/lib/aarch64-linux-gnu on arm64, while on amd64 debootstrap links it to
+ # /usr/lib64 and doesn't create it at all on arm64.
+ # See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019575
+ local arch_directories="/lib64 /lib32 /libo32 /libx32"
+ for dir in $arch_directories; do
+ [ -e "$DPKG_ROOT$dir" ] || continue
+ case "$(readlink -f "$DPKG_ROOT$dir")" in
+ "$DPKG_ROOT/usr/lib"*) ;;
+ *) return 1;;
+ esac
+ done
+
+ return 0
+}
+
+fail_if_unmerged() {
+ if is_merged; then return; fi
+
+ cat << END
+
+
+******************************************************************************
+*
+* The systemd package cannot be installed because this system does
+* not have a merged /usr.
+*
+* Please install the usrmerge package to convert this system to merged-/usr.
+*
+* For more information please read https://wiki.debian.org/UsrMerge.
+*
+******************************************************************************
+
+
+END
+ exit 1
+}
+
+case "$1" in
+ install|upgrade)
+ fail_if_unmerged
+ ;;
+esac
+
+#DEBHELPER#