summaryrefslogtreecommitdiffstats
path: root/debian/dpkg.postinst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:35:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:35:34 +0000
commit3fa257bb4ed88187fb3e5f4ab13c18b4fac22cc6 (patch)
tree9eaf6d3ef113c0f4dd9c8c91557bf84941fe7d93 /debian/dpkg.postinst
parentAdding upstream version 1.22.4. (diff)
downloaddpkg-3fa257bb4ed88187fb3e5f4ab13c18b4fac22cc6.tar.xz
dpkg-3fa257bb4ed88187fb3e5f4ab13c18b4fac22cc6.zip
Adding debian version 1.22.4.debian/1.22.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/dpkg.postinst')
-rw-r--r--debian/dpkg.postinst89
1 files changed, 89 insertions, 0 deletions
diff --git a/debian/dpkg.postinst b/debian/dpkg.postinst
new file mode 100644
index 0000000..113c8d5
--- /dev/null
+++ b/debian/dpkg.postinst
@@ -0,0 +1,89 @@
+#!/bin/sh
+# See deb-postinst(5).
+
+set -e
+
+PROGNAME=dpkg
+
+. /usr/share/dpkg/sh/dpkg-error.sh
+
+setup_colors
+
+get_vendor()
+{
+ local origin="$DPKG_ROOT/etc/dpkg/origins/default"
+ local vendor
+
+ if [ -n "$DEB_VENDOR" ]; then
+ vendor="$DEB_VENDOR"
+ elif [ -e "$origin" ]; then
+ vendor=$(sed -ne 's/^Vendor: *\([^ ]\+\) */\1/p' "$origin" | tr A-Z a-z)
+ fi
+
+ echo "${vendor:-default}"
+}
+
+check_merged_usr_via_aliased_dirs()
+{
+ local vendor
+
+ vendor=$(get_vendor)
+
+ case "$vendor" in
+ debian)
+ # In Debian some people have gotten so offended by the following _warning_
+ # that they have resorted to bullying and abuse. Life's too short, sorry.
+ return
+ ;;
+ ubuntu)
+ # Ubuntu does not seem interested in it.
+ return
+ ;;
+ esac
+
+ for d in /bin /sbin /lib /lib32 /libo32 /libx32 /lib64; do
+ linkname="$(readlink $DPKG_ROOT$d || true)"
+ if [ "$linkname" = "usr$d" ] || [ "$linkname" = "/usr$d" ]; then
+ warning "This system uses merged-usr-via-aliased-dirs, going behind dpkg's"
+ warning "back, breaking its core assumptions. This can cause silent file"
+ warning "overwrites and disappearances, and its general tools misbehavior."
+ warning "See <https://wiki.debian.org/Teams/Dpkg/FAQ#broken-usrmerge>."
+ break
+ fi
+ done
+}
+
+setup_aliases()
+{
+ local prog=start-stop-daemon
+
+ # Add a backward compatibility symlink alias for s-s-d, which is now
+ # installed in its canonical location.
+ if [ ! -f "$DPKG_ROOT/sbin/$prog" ]; then
+ ln -s "/usr/sbin/$prog" "$DPKG_ROOT/sbin/$prog"
+ fi
+}
+
+case "$1" in
+configure)
+ check_merged_usr_via_aliased_dirs
+ setup_aliases
+ ;;
+abort-upgrade|abort-deconfigure|abort-remove)
+ ;;
+*)
+ error "called with unknown argument '$1'"
+ ;;
+esac
+
+# Due to #932360 in debhelper we need to explicitly tell systemd to reload.
+case "$1" in
+configure|abort-upgrade|abort-deconfigure|abort-remove)
+ if [ -d /run/systemd/system ]; then
+ systemctl --system daemon-reload >/dev/null || true
+ fi
+ ;;
+esac
+
+#DEBHELPER#
+exit 0