libdpkg: Deindent an else clause
[dpkg.git] / debian / dpkg.postinst
blob113c8d53ae556ea74cf9df06775fef76c8dd09c9
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 [ -n "$DEB_VENDOR" ]; then
18 vendor="$DEB_VENDOR"
19 elif [ -e "$origin" ]; then
20 vendor=$(sed -ne 's/^Vendor: *\([^ ]\+\) */\1/p' "$origin" | tr A-Z a-z)
23 echo "${vendor:-default}"
26 check_merged_usr_via_aliased_dirs()
28 local vendor
30 vendor=$(get_vendor)
32 case "$vendor" in
33 debian)
34 # In Debian some people have gotten so offended by the following _warning_
35 # that they have resorted to bullying and abuse. Life's too short, sorry.
36 return
38 ubuntu)
39 # Ubuntu does not seem interested in it.
40 return
42 esac
44 for d in /bin /sbin /lib /lib32 /libo32 /libx32 /lib64; do
45 linkname="$(readlink $DPKG_ROOT$d || true)"
46 if [ "$linkname" = "usr$d" ] || [ "$linkname" = "/usr$d" ]; then
47 warning "This system uses merged-usr-via-aliased-dirs, going behind dpkg's"
48 warning "back, breaking its core assumptions. This can cause silent file"
49 warning "overwrites and disappearances, and its general tools misbehavior."
50 warning "See <https://wiki.debian.org/Teams/Dpkg/FAQ#broken-usrmerge>."
51 break
53 done
56 setup_aliases()
58 local prog=start-stop-daemon
60 # Add a backward compatibility symlink alias for s-s-d, which is now
61 # installed in its canonical location.
62 if [ ! -f "$DPKG_ROOT/sbin/$prog" ]; then
63 ln -s "/usr/sbin/$prog" "$DPKG_ROOT/sbin/$prog"
67 case "$1" in
68 configure)
69 check_merged_usr_via_aliased_dirs
70 setup_aliases
72 abort-upgrade|abort-deconfigure|abort-remove)
75 error "called with unknown argument '$1'"
77 esac
79 # Due to #932360 in debhelper we need to explicitly tell systemd to reload.
80 case "$1" in
81 configure|abort-upgrade|abort-deconfigure|abort-remove)
82 if [ -d /run/systemd/system ]; then
83 systemctl --system daemon-reload >/dev/null || true
86 esac
88 #DEBHELPER#
89 exit 0