| 1 |
#! /bin/bash |
| 2 |
# pbuilder -- personal Debian package builder |
| 3 |
# Copyright © 2001-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 |
# module to satisfy build dependencies; parse command line parameters |
| 21 |
|
| 22 |
|
| 23 |
BUILD_ARCH="$(dpkg --print-architecture)" |
| 24 |
HOST_ARCH="$BUILD_ARCH" |
| 25 |
DEBIAN_CONTROL=debian/control |
| 26 |
CHROOT="" |
| 27 |
CHROOTEXEC="" |
| 28 |
BINARY_ARCH="any" |
| 29 |
FORCEVERSION="" |
| 30 |
CONTINUE_FAIL="no" |
| 31 |
CHROOTEXEC_AFTER_INTERNAL_CHROOTEXEC=no |
| 32 |
ALLOWUNTRUSTED=no |
| 33 |
EATMYDATA=no |
| 34 |
|
| 35 |
while [ -n "$1" ]; do |
| 36 |
case "$1" in |
| 37 |
--control|-c) |
| 38 |
DEBIAN_CONTROL="$2" |
| 39 |
shift; shift |
| 40 |
;; |
| 41 |
|
| 42 |
# --chroot option and --internal-chrootexec options and --echo options somewhat conflict with each other. |
| 43 |
|
| 44 |
--chroot) |
| 45 |
CHROOT="$2" |
| 46 |
CHROOTEXEC="chroot $2 " |
| 47 |
if [ ${CHROOTEXEC_AFTER_INTERNAL_CHROOTEXEC} = maybe ]; then |
| 48 |
echo '--chroot specified after --internal-chrootexec' >&2 |
| 49 |
exit 1 |
| 50 |
fi |
| 51 |
shift; shift |
| 52 |
;; |
| 53 |
--internal-chrootexec) |
| 54 |
CHROOTEXEC="$2" |
| 55 |
CHROOTEXEC_AFTER_INTERNAL_CHROOTEXEC=maybe |
| 56 |
shift; shift |
| 57 |
;; |
| 58 |
--echo) |
| 59 |
CHROOTEXEC="echo $CHROOTEXEC" |
| 60 |
CHROOTEXEC_AFTER_INTERNAL_CHROOTEXEC=maybe |
| 61 |
shift |
| 62 |
;; |
| 63 |
|
| 64 |
--binary-all) |
| 65 |
BINARY_ARCH="any" |
| 66 |
shift |
| 67 |
;; |
| 68 |
--binary-arch) |
| 69 |
BINARY_ARCH="binary" |
| 70 |
shift |
| 71 |
;; |
| 72 |
--binary-indep) |
| 73 |
BINARY_ARCH="all" |
| 74 |
shift |
| 75 |
;; |
| 76 |
--continue-fail) |
| 77 |
CONTINUE_FAIL="yes" |
| 78 |
shift |
| 79 |
;; |
| 80 |
--force-version) |
| 81 |
FORCEVERSION="yes" |
| 82 |
shift; |
| 83 |
;; |
| 84 |
--check-key) |
| 85 |
ALLOWUNTRUSTED=no |
| 86 |
shift; |
| 87 |
;; |
| 88 |
--allow-untrusted) |
| 89 |
ALLOWUNTRUSTED=yes |
| 90 |
shift; |
| 91 |
;; |
| 92 |
--eatmydata) |
| 93 |
EATMYDATA=yes |
| 94 |
shift |
| 95 |
;; |
| 96 |
--build-arch) |
| 97 |
BUILD_ARCH=$2 |
| 98 |
shift 2 |
| 99 |
;; |
| 100 |
--host-arch) |
| 101 |
HOST_ARCH=$2 |
| 102 |
shift 2 |
| 103 |
;; |
| 104 |
--help|-h|*) |
| 105 |
print_help |
| 106 |
exit 1 |
| 107 |
;; |
| 108 |
esac |
| 109 |
done |
| 110 |
|
| 111 |
if [ $ALLOWUNTRUSTED = yes ]; then |
| 112 |
# Also duplicated in pbuilder-checkparams! |
| 113 |
# apt flag to accept untrusted packages |
| 114 |
APTGETOPT[${#APTGETOPT[@]}]='--force-yes' |
| 115 |
# aptitude flag to accept untrusted packages |
| 116 |
APTITUDEOPT[${#APTITUDEOPT[@]}]='-o' |
| 117 |
APTITUDEOPT[${#APTITUDEOPT[@]}]='Aptitude::CmdLine::Ignore-Trust-Violations=true' |
| 118 |
fi |
| 119 |
|
| 120 |
if [ "$EATMYDATA" = "yes" ]; then |
| 121 |
CHROOTEXEC="$CHROOTEXEC eatmydata" |
| 122 |
fi |
| 123 |
|
| 124 |
checkbuilddep_internal |