version: 2.45-4 (UNRELEASED) commit: bf4f75f17a4f370adc9bf9feca09710ce76ecc63
48 lines
993 B
Bash
48 lines
993 B
Bash
#! /bin/sh
|
|
set -e
|
|
this_ver=@DEB_VER@; # this version
|
|
ma=@DEB_MULTIARCH@
|
|
triplet=@DEB_TRIPLET@
|
|
# action: upgrade, abort-upgrade, remove, abort-install, disappear,
|
|
# purge, or failed-upgrade.
|
|
context=$1
|
|
if
|
|
test "$context" = failed-upgrade &&
|
|
dpkg --compare-versions "$this_ver" lt "$2"
|
|
then
|
|
# postrm of the future failed.
|
|
# Who knows what it was supposed to do? Abort.
|
|
exit 1
|
|
fi
|
|
new_ver=; # version replacing this one, if any.
|
|
case "$context" in
|
|
failed-upgrade)
|
|
new_ver=$this_ver ;;
|
|
abort-install|disappear)
|
|
new_ver= ;;
|
|
*)
|
|
new_ver=$2 ;;
|
|
esac
|
|
|
|
diversion() {
|
|
local added_ver divertto file
|
|
added_ver=$1
|
|
file=$2
|
|
divertto=${3-$file.single}
|
|
|
|
if
|
|
test "$context" != purge &&
|
|
dpkg --compare-versions "$new_ver" lt "$added_ver"
|
|
then
|
|
dpkg-divert --package binutils-multiarch \
|
|
--remove --rename --divert "$divertto" "$file"
|
|
fi
|
|
}
|
|
|
|
|
|
for prog in nm objdump objcopy strings strip size \
|
|
ar ranlib addr2line gprof readelf
|
|
do
|
|
diversion 2.27-8 "/usr/bin/$triplet-$prog"
|
|
done
|