| 1 |
#! /bin/bash |
| 2 |
# lvmbuilder -- Debian package builder using LVM |
| 3 |
# Copyright (C) 2007 Kapil Hari Paranjape |
| 4 |
# based on: |
| 5 |
# pbuilder -- personal Debian package builder |
| 6 |
# Copyright (C) 2001-2006 Junichi Uekawa |
| 7 |
# |
| 8 |
# This program is free software; you can redistribute it and/or modify |
| 9 |
# it under the terms of the GNU General Public License as published by |
| 10 |
# the Free Software Foundation; either version 2 of the License, or |
| 11 |
# (at your option) any later version. |
| 12 |
# |
| 13 |
# This program is distributed in the hope that it will be useful, |
| 14 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
# GNU General Public License for more details. |
| 17 |
# |
| 18 |
# You should have received a copy of the GNU General Public License |
| 19 |
# along with this program; if not, write to the Free Software |
| 20 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 |
|
| 22 |
# lvmbuilder by Kapil Hari Paranjape <[email protected]> 2007 Aug 15 |
| 23 |
# pbuilder by Junichi Uekawa <[email protected]> 2001 Aug 25 |
| 24 |
|
| 25 |
set -e |
| 26 |
|
| 27 |
# Base directory for LVM stuff |
| 28 |
LVMBLIB=./lib 'LVMBLIB needs to be defined' |
| 29 |
|
| 30 |
# For safe file creation |
| 31 |
umask 0022 |
| 32 |
|
| 33 |
# command line operation |
| 34 |
OP="$1" |
| 35 |
shift |
| 36 |
|
| 37 |
case "$OP" in |
| 38 |
--create|create) |
| 39 |
. ${LVMBLIB}/lvmbuilder-checkparams |
| 40 |
. ${LVMBLIB}/lvmbuilder-modules |
| 41 |
clean_basedev |
| 42 |
mount $BASEDEV $BUILDPLACE |
| 43 |
trap unmount_basedev exit |
| 44 |
pbuilder "$OP" "${PBCMDLINE[@]}" |
| 45 |
;; |
| 46 |
--update|update) |
| 47 |
. ${LVMBLIB}/lvmbuilder-checkparams |
| 48 |
. ${LVMBLIB}/lvmbuilder-modules |
| 49 |
mount $BASEDEV $BUILDPLACE |
| 50 |
trap unmount_basedev exit |
| 51 |
pbuilder "$OP" "${PBCMDLINE[@]}" |
| 52 |
;; |
| 53 |
--clean|clean) |
| 54 |
. ${LVMBLIB}/lvmbuilder-checkparams |
| 55 |
. ${LVMBLIB}/lvmbuilder-modules |
| 56 |
clean_basedev |
| 57 |
. /usr/lib/pbuilder/pbuilder-checkparams |
| 58 |
if [ -n "$APTCACHE" ]; then |
| 59 |
echo "Cleaning [$APTCACHE]" |
| 60 |
clean_subdirectories "$APTCACHE" || true |
| 61 |
fi |
| 62 |
;; |
| 63 |
--build|build|--login|login|--execute|execute) |
| 64 |
. ${LVMBLIB}/lvmbuilder-checkparams |
| 65 |
. ${LVMBLIB}/lvmbuilder-modules |
| 66 |
setup_workplace |
| 67 |
trap takedown_workplace exit |
| 68 |
pbuilder "$OP" "${PBCMDLINE[@]}" |
| 69 |
;; |
| 70 |
--dumpconfig|dumpconfig) |
| 71 |
. ${LVMBLIB}/lvmbuilder-checkparams |
| 72 |
. ${LVMBLIB}/lvmbuilder-modules |
| 73 |
echo " -> start dump config" |
| 74 |
echo " -> set" |
| 75 |
set; |
| 76 |
echo " -> env" |
| 77 |
env; |
| 78 |
echo " -> end dump config" |
| 79 |
;; |
| 80 |
--debuild|debuild) |
| 81 |
echo "E: The debuild mode of pbuilder is currently not supported by lvmbuilder." >&2 |
| 82 |
exit 1 |
| 83 |
;; |
| 84 |
*) |
| 85 |
. ${LVMBLIB}/lvmbuilder-modules |
| 86 |
showhelp |
| 87 |
;; |
| 88 |
esac |
| 89 |
|