| 1 |
#!/bin/sh -e |
| 2 |
|
| 3 |
is_merged() { |
| 4 |
local directories="/bin /sbin /lib" |
| 5 |
for dir in $directories; do |
| 6 |
[ -e "$DPKG_ROOT$dir" ] || continue |
| 7 |
[ "$(readlink -f "$DPKG_ROOT$dir")" = "$DPKG_ROOT/usr$dir" ] || return 1 |
| 8 |
done |
| 9 |
|
| 10 |
# Avoid an exact match, as the target might vary depending on the tool |
| 11 |
# building the image. For example, systemd-nspawn links /lib64 to |
| 12 |
# /usr/lib/aarch64-linux-gnu on arm64, while on amd64 debootstrap links it to |
| 13 |
# /usr/lib64 and doesn't create it at all on arm64. |
| 14 |
# See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019575 |
| 15 |
local arch_directories="/lib64 /lib32 /libo32 /libx32" |
| 16 |
for dir in $arch_directories; do |
| 17 |
[ -e "$DPKG_ROOT$dir" ] || continue |
| 18 |
case "$(readlink -f "$DPKG_ROOT$dir")" in |
| 19 |
"$DPKG_ROOT/usr/lib"*) ;; |
| 20 |
*) return 1;; |
| 21 |
esac |
| 22 |
done |
| 23 |
|
| 24 |
return 0 |
| 25 |
} |
| 26 |
|
| 27 |
fail_if_unmerged() { |
| 28 |
if is_merged; then return; fi |
| 29 |
|
| 30 |
cat << END |
| 31 |
|
| 32 |
|
| 33 |
****************************************************************************** |
| 34 |
* |
| 35 |
* The usr-is-merged package cannot be installed because this system does |
| 36 |
* not have a merged /usr. |
| 37 |
* |
| 38 |
* Please install the usrmerge package to convert this system to merged-/usr. |
| 39 |
* |
| 40 |
* For more information please read https://wiki.debian.org/UsrMerge. |
| 41 |
* |
| 42 |
****************************************************************************** |
| 43 |
|
| 44 |
|
| 45 |
END |
| 46 |
exit 1 |
| 47 |
} |
| 48 |
|
| 49 |
case "$1" in |
| 50 |
install|upgrade) |
| 51 |
fail_if_unmerged |
| 52 |
;; |
| 53 |
esac |
| 54 |
|
| 55 |
#DEBHELPER# |
| 56 |
|