blob: d816183cd36b179b3af29918fe2a1f3efb09b723 (
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
#! /bin/bash
# pbuilder -- personal Debian package builder
# Copyright (C) 2001-2007 Junichi Uekawa
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# pbuilder by Junichi Uekawa <dancer@debian.org> 2001 Aug 25
set -e
# export this so that programs know which command line
# operation is currently done
export PBCURRENTCOMMANDLINEOPERATION="$1"
umask 0022
case "$1" in
--create|create)
shift;
/usr/lib/pbuilder/pbuilder-createbuildenv "$@"
;;
--update|update)
shift ;
/usr/lib/pbuilder/pbuilder-updatebuildenv "$@"
;;
--build|build)
shift ;
/usr/lib/pbuilder/pbuilder-buildpackage "$@"
;;
--clean|clean)
shift;
. /usr/lib/pbuilder/pbuilder-checkparams
if [ -n "$BASEBUILDPLACE" ]; then
log "I: Cleaning [$BASEBUILDPLACE]"
clean_subdirectories "$BASEBUILDPLACE" || true
fi
if [ -n "$APTCACHE" ]; then
log "I: Cleaning [$APTCACHE]"
rm "$APTCACHE"/* || true
fi
;;
--login|login)
shift
. /usr/lib/pbuilder/pbuilder-checkparams
. /usr/lib/pbuilder/pbuilder-runhooks
extractbuildplace
trap umountproc_cleanbuildplace_trap exit sighup
copyinputfile "${BUILDPLACE}/tmp/buildd"
loadhooks
recover_aptcache
trap saveaptcache_umountproc_cleanbuildplace_trap exit sighup
if [ "${INTERNAL_BUILD_UML}" = "yes" ]; then
log "I: entering the shell"
else
log "I: entering the shell
File extracted to: $BUILDPLACE
"
fi
executehooks "F"
(${CHROOTEXEC} bin/bash -c 'exec -a -bash bin/bash')
RET=$?
save_aptcache
trap umountproc_cleanbuildplace_trap exit sighup
# saving the place afterwards
if [ "${SAVE_AFTER_LOGIN}" = "yes" ]; then
if [ "${INTERNAL_BUILD_UML}" = "yes" ]; then
log "E: Invalid combination of internal-build-uml and save-after-login flags"
exit 1
else
log "I: Saving the results, modifications to this session will persist"
unloadhooks
umountproc
trap cleanbuildplace_trap exit sighup
${CHROOTEXEC} /usr/bin/apt-get clean || true
create_basetgz
cleanbuildplace
trap - exit sighup
exit $RET
fi
fi
umountproc_cleanbuildplace
trap - exit sighup
exit $RET
;;
--execute|execute)
# try to execute arbitrary program.
shift
. /usr/lib/pbuilder/pbuilder-checkparams
. /usr/lib/pbuilder/pbuilder-runhooks
EXECPROGRAM="$1"
shift
if [ ! -f "${EXECPROGRAM}" ]; then
log "E: Command line parameter [$EXECPROGRAM] does not exist"
exit 1;
fi;
extractbuildplace
trap umountproc_cleanbuildplace_trap exit sighup
copyinputfile "${BUILDPLACE}/tmp/buildd"
loadhooks
recover_aptcache
trap saveaptcache_umountproc_cleanbuildplace_trap exit sighup
RUNNAME="$BUILDPLACE/runscript"
cat "$EXECPROGRAM" > "$RUNNAME"
chmod a+x "$RUNNAME"
executehooks "F"
( ${CHROOTEXEC} /runscript "$@" )
RET=$?
rm -f "$RUNNAME"
save_aptcache
trap umountproc_cleanbuildplace_trap exit sighup
# saving the place afterwards
if [ "${SAVE_AFTER_LOGIN}" = "yes" ]; then
if [ "${INTERNAL_BUILD_UML}" = "yes" ]; then
log "E: Invalid combination of internal-build-uml and save-after-login flags"
else
log "I: Saving the results, modifications to this session will persist"
unloadhooks
umountproc
trap cleanbuildplace_trap exit sighup
${CHROOTEXEC} /usr/bin/apt-get clean || true
create_basetgz
cleanbuildplace
trap - exit sighup
exit $RET
fi
fi
umountproc_cleanbuildplace
trap - exit sighup
exit $RET
;;
--dumpconfig|dumpconfig)
shift
. /usr/lib/pbuilder/pbuilder-checkparams
. /usr/lib/pbuilder/pbuilder-runhooks
extractbuildplace
trap umountproc_cleanbuildplace_trap exit sighup
loadhooks
executehooks "F"
log "I: start dump config"
log "I: set"
set;
log "I: env"
env;
log "I: end dump config"
;;
--debuild|debuild)
shift
"$0" execute "$@" /usr/lib/pbuilder/pdebuild-internal
;;
*)
. /usr/lib/pbuilder/pbuilder-modules
showhelp
;;
esac
|