File: binutils-multiarch.postrm.in

package info (click to toggle)
binutils 2.35.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 345,288 kB
  • sloc: ansic: 1,188,423; asm: 674,501; cpp: 131,090; exp: 70,858; makefile: 57,650; sh: 22,573; yacc: 14,459; lisp: 13,803; perl: 2,112; ada: 1,681; lex: 1,649; pascal: 1,446; cs: 879; sed: 195; python: 154; xml: 95; awk: 25
file content (47 lines) | stat: -rw-r--r-- 993 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /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