File: pre_remove_prerm_postrm_set-x

package info (click to toggle)
piuparts 1.6.0
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 72,532 kB
  • sloc: python: 8,240; sh: 4,367; makefile: 171
file content (28 lines) | stat: -rwxr-xr-x 591 bytes parent folder | download | duplicates (6)
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
#!/bin/sh
set -e

set_minus_x()
{
	local script=$1

	if [ -f $script ]; then
		if head -n 1 $script | grep -qE '/bin/(ba)?sh' ; then
			echo "DEBUG REMOVE: enabling 'set -x' in ${script##*/}"
			sed -i '2 i set -x' $script
		else
			echo "Unsupported script type in $script:"
			head -n 1 $script
		fi
	fi
}

arch=$(dpkg --print-architecture)

for target in ${PIUPARTS_OBJECTS%%=*}
do
	pkg=${target}
	set_minus_x /var/lib/dpkg/info/$pkg.prerm
	set_minus_x /var/lib/dpkg/info/$pkg.postrm
	set_minus_x /var/lib/dpkg/info/$pkg:$arch.prerm
	set_minus_x /var/lib/dpkg/info/$pkg:$arch.postrm
done