aboutsummaryrefslogtreecommitdiff
path: root/pbuilder-checkparams
blob: 45dcd4e7902c70e4ccab6d1dfb6dd8a65baf92f6 (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#! /bin/bash 
# this is sourced from pbuilder packages to process the optional parameters.

# empty some vars.
DPKG_BUILDPACKAGEOPT=""

. /etc/pbuilderrc
. /usr/lib/pbuilder/pbuilder-modules

# the default is to add a PID in the buildplace specified in the config file.
BASEBUILDPLACE="$BUILDPLACE"
BUILDPLACE="$BUILDPLACE/$$"

while [ -n "$1" ]; do 
    case "$1" in 
	--basetgz) 
	    BASETGZ=$(readlink -f "$2");
	    shift; shift;
	    ;;
	--buildplace)
	    BUILDPLACE=$(readlink -f "$2");
	    shift; shift;
	    ;;
	--mirror)
	    MIRRORSITE="$2";
	    shift; shift;
	    ;;
	--nonusmirror)
	    NONUSMIRRORSITE="$2";
	    shift; shift;
	    ;;
	--othermirror)
	    OTHERMIRROR="$3";
	    shift; shift;
	    ;;
	--http-proxy)
	    export http_proxy="$2";
	    shift; shift;
	    ;;
	--distribution)
	    DISTRIBUTION="$2";
	    shift; shift;
	    ;;
	--buildresult)
	    BUILDRESULT=$(readlink -f "$2");
	    shift; shift;
	    ;;
	--removepackages)
	    REMOVEPACKAGES="$2";
	    shift; shift;
	    ;;
	--configfile)
	    . "$2";
	    shift; shift; 
	    ;;
	--extrapackages)
	    EXTRAPACKAGES="$2";
	    shift; shift;
	    ;;
	--hookdir)
	    HOOKDIR="$2";
	    shift; shift;
	    ;;
	--debemail)
	    DEBEMAIL="$2";
	    shift; shift;
	    ;;
	--buildsourceroot*)
	    BUILDSOURCEROOTCMD="$2";
	    shift; shift;
	    ;;
	--pbuilderroot*)
	    PBUILDERROOTCMD="$2";
	    shift; shift;
	    ;;
	--logfile)
	    exec 2>&1 > $(readlink -f "$2");
	    shift; shift;
	    ;;
	--help)
	    showhelp
	    ;;
	--) # this is an empty option, to no longer process.
	    shift; 
	    break;
	    ;;
	--*)
	    echo "Error: Unknown option [$1] was specified " >&2 
	    exit 1;
	    ;;
	*)
	    break;
	    ;;
  esac
done

BUILDPLACE=${BUILDPLACE?"Build root directory is not defined"}
if [ -z "$DEBEMAIL" ]; then
    DEBEMAIL="nobody@nowhere"
fi

case "$PBCURRENTCOMMANDLINEOPERATION" in 
    login)
	# don't do anything if it is "login"
	;;
    *)
# line from kobras@debian.org
	if [ "$DEBIAN_FRONTEND" = "noninteractive" ]; then
	    exec < /dev/null
	fi
	;;
esac