| 1 |
#! /bin/bash |
| 2 |
# pbuilder -- personal Debian package builder |
| 3 |
# Copyright © 2005-2007 Junichi Uekawa <[email protected]> |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 2 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 |
############################################################################### |
| 19 |
|
| 20 |
# This code is called for pdebuild |
| 21 |
|
| 22 |
. /usr/lib/pbuilder/pbuilder-loadconfig |
| 23 |
. /usr/lib/pbuilder/pbuilder-modules |
| 24 |
|
| 25 |
PBUILDER_BUILD_LOGFILE= |
| 26 |
|
| 27 |
while [ -n "$1" ]; do |
| 28 |
case "$1" in |
| 29 |
# pbuilder-shared options. |
| 30 |
--buildresult) |
| 31 |
if [ -n "$2" ]; then |
| 32 |
if [ -d "$2" ]; then |
| 33 |
BUILDRESULT=$(readlink -f "$2"); |
| 34 |
else |
| 35 |
BUILDRESULT="$2" |
| 36 |
log.w "Build-result Directory $2 does not exist" |
| 37 |
# warn, but make it progress. |
| 38 |
fi |
| 39 |
else |
| 40 |
BUILDRESULT= |
| 41 |
fi |
| 42 |
shift; shift; |
| 43 |
;; |
| 44 |
--debbuildopts) |
| 45 |
DEBBUILDOPTS="${2:+$DEBBUILDOPTS $2}"; |
| 46 |
shift; shift; |
| 47 |
;; |
| 48 |
--configfile) |
| 49 |
if [ ! -f "$2" ]; then |
| 50 |
log.e "Config file $2 does not exist" |
| 51 |
exit 1 |
| 52 |
fi |
| 53 |
. "$2"; |
| 54 |
EXTRA_CONFIGFILE[${#EXTRA_CONFIGFILE[@]}]="$2"; |
| 55 |
shift; shift; |
| 56 |
;; |
| 57 |
# pdebuild specific options. |
| 58 |
--architecture) |
| 59 |
ARCHITECTURE="$2" |
| 60 |
shift; shift; |
| 61 |
;; |
| 62 |
--auto-debsign) |
| 63 |
AUTO_DEBSIGN="yes" |
| 64 |
shift; |
| 65 |
;; |
| 66 |
--debsign-k) |
| 67 |
DEBSIGN_KEYID="$2" |
| 68 |
shift; shift; |
| 69 |
;; |
| 70 |
--buildsourceroot*) |
| 71 |
BUILDSOURCEROOTCMD="$2"; |
| 72 |
shift; shift; |
| 73 |
;; |
| 74 |
--pbuilderroot*) |
| 75 |
PBUILDERROOTCMD="$2"; |
| 76 |
shift; shift; |
| 77 |
;; |
| 78 |
--pbuildersatisfydepends*) |
| 79 |
PBUILDERSATISFYDEPENDSCMD="$2"; |
| 80 |
shift; shift; |
| 81 |
;; |
| 82 |
--use-pdebuild-internal) |
| 83 |
USE_PDEBUILD_INTERNAL=yes; |
| 84 |
shift; |
| 85 |
;; |
| 86 |
--debug) |
| 87 |
PBUILDER_DEBUGMODE=yes |
| 88 |
set -x |
| 89 |
shift; |
| 90 |
;; |
| 91 |
--logfile) |
| 92 |
log.i "Logging to $2" |
| 93 |
PBUILDER_BUILD_LOGFILE=$(readlink -f $2) |
| 94 |
exec > >(tee "$2") 2>&1 |
| 95 |
shift; shift; |
| 96 |
;; |
| 97 |
--pbuilder) |
| 98 |
log.i "using $2 as pbuilder" |
| 99 |
PDEBUILD_PBUILDER="$2" |
| 100 |
shift; shift; |
| 101 |
;; |
| 102 |
--help) |
| 103 |
showhelp |
| 104 |
exit 0 |
| 105 |
;; |
| 106 |
--) # end of processing for this |
| 107 |
shift; |
| 108 |
break; |
| 109 |
;; |
| 110 |
--*) |
| 111 |
log.e "Unknown option [$1] was specified " |
| 112 |
exit 1; |
| 113 |
;; |
| 114 |
*) |
| 115 |
break; |
| 116 |
;; |
| 117 |
esac |
| 118 |
done |
| 119 |
|
| 120 |
BUILDPLACE=${BUILDPLACE?"Build root directory is not defined"} |
| 121 |
|
| 122 |
# the default is to add a PID in the buildplace specified in the config file. |
| 123 |
BASEBUILDPLACE="$BUILDPLACE" |
| 124 |
if [ "${INTERNAL_BUILD_UML}" != "yes" -a "${PRESERVE_BUILDPLACE}" != "yes" ]; then |
| 125 |
BUILDPLACE="$BUILDPLACE/$$" |
| 126 |
fi |
| 127 |
if [ -z "${CHROOTEXEC}" ]; then |
| 128 |
CHROOTEXEC="chroot $BUILDPLACE " |
| 129 |
fi |
| 130 |
|
| 131 |
if [ -z "${PDEBUILD_PBUILDER}" ]; then |
| 132 |
PDEBUILD_PBUILDER="pbuilder" |
| 133 |
fi |