scripts/mk: On dpkg-build-api >= 1 include buildtools.mk in default.mk
[dpkg.git] / debian / dpkg.postinst
blob867a9e6928198aa72e0a696cadd4e34946e75ca1
1 #!/bin/sh
2 # See deb-postinst(5).
4 set -e
6 PROGNAME=dpkg
8 . /usr/share/dpkg/sh/dpkg-error.sh
10 setup_colors
12 get_vendor()
14 local origin="$DPKG_ROOT/etc/dpkg/origins/default"
15 local vendor
17 if [ -e "$origin" ]; then
18 vendor=$(sed -ne 's/^Vendor: *\([^ ]\+\) */\1/p' "$origin" | tr A-Z a-z)
21 echo "${vendor:-default}"
24 check_merged_usr_via_aliased_dirs()
26 local vendor
28 vendor=$(get_vendor)
30 case "$vendor" in
31 debian)
32 # In Debian some people have gotten so offended by the following _warning_
33 # that they have resorted to bullying and abuse. Life's too short, sorry.
34 return
36 ubuntu)
37 # Ubuntu does not seem interested in it.
38 return
40 esac
42 for d in /bin /sbin /lib /lib32 /libo32 /libx32 /lib64; do
43 linkname="$(readlink $DPKG_ROOT$d || true)"
44 if [ "$linkname" = "usr$d" ] || [ "$linkname" = "/usr$d" ]; then
45 warning "This system uses merged-usr-via-aliased-dirs, going behind dpkg's"
46 warning "back, breaking its core assumptions. This can cause silent file"
47 warning "overwrites and disappearances, and its general tools misbehavior."
48 warning "See <https://wiki.debian.org/Teams/Dpkg/FAQ#broken-usrmerge>."
49 break
51 done
54 case "$1" in
55 configure)
56 check_merged_usr_via_aliased_dirs
58 abort-upgrade|abort-deconfigure|abort-remove)
61 error "called with unknown argument '$1'"
63 esac
65 #DEBHELPER#
66 exit 0