~ubuntu-branches/ubuntu/vivid/pkgbinarymangler/vivid

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
48
49
50
51
52
53
54
55
#!/bin/bash -e

ORIGINAL_ARGUMENTS=$@
BUILD="false"
while [ $# -gt 0 ]; do
	case "$1" in
		--build|-b)
			BUILD="true"
			shift ;;
		*)
			shift ;;
	esac
done

if [ "$BUILD" = "true" ]; then
        if grep -qs '^Suite: [a-z]*-autotest' /CurrentlyBuilding; then
            NO_PKG_MANGLE=1
            echo "INFO: Disabling pkgbinarymangler for archive rebuild test"
        fi
        if grep -qs '^Purpose: PPA' /CurrentlyBuilding; then
            NO_PKG_MANGLE=1
            echo "INFO: Disabling pkgbinarymangler for PPA build"
        fi
        if grep -q '^Section: partner' debian/control; then
            NO_PKG_MANGLE=1
            echo "INFO: Disabling pkgbinarymangler for partner packages"
        fi
	if [ -z "$NO_PKG_MANGLE" ]; then
		if [ -x /usr/bin/pkgsanitychecks ]; then
			/usr/bin/pkgsanitychecks $ORIGINAL_ARGUMENTS
		else
			echo "ERROR: dpkg-deb is diverted, but /usr/bin/pkgsanitychecks"
			echo "ERROR: is not executable; please check your configuration"
			exit 1
		fi
		if [ -x /usr/bin/pkgstriptranslations ]; then
			/usr/bin/pkgstriptranslations
		else
			echo "ERROR: dpkg-deb is diverted, but /usr/bin/pkgstriptranslations"
			echo "ERROR: is not executable; please check your configuration"
			exit 1
		fi
		if [ -x /usr/bin/pkgmaintainermangler ]; then
			/usr/bin/pkgmaintainermangler $ORIGINAL_ARGUMENTS
		else
			echo "ERROR: dpkg-deb is diverted, but /usr/bin/pkgmaintainermangler"
			echo "ERROR: is not executable; please check your configuration"
			exit 1
		fi
	else
		echo "WARNING: not running pkgbinarymangler for this package, as requested"
	fi
fi

exec -a /usr/bin/dpkg-deb /usr/bin/dpkg-deb.pkgbinarymangler $ORIGINAL_ARGUMENTS