aboutsummaryrefslogtreecommitdiff
path: root/examples/lvmpbuilder/lvmbuilder
blob: eb373f3df8aeb71289ffe48a0124dd41a366cd0a (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
#! /bin/bash
#   lvmbuilder -- Debian package builder using LVM
#   Copyright (C) 2007 Kapil Hari Paranjape
#   based on:
#   pbuilder -- personal Debian package builder
#   Copyright (C) 2001-2006 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

# lvmbuilder by Kapil Hari Paranjape <kapil@debian.org> 2007 Aug 15
# pbuilder by Junichi Uekawa <dancer@debian.org> 2001 Aug 25

set -e 

# Base directory for LVM stuff
LVMBLIB=./lib 'LVMBLIB needs to be defined'

# For safe file creation
umask 0022

# command line operation
OP="$1"
shift

case "$OP" in
    --create|create)
	. ${LVMBLIB}/lvmbuilder-checkparams
	. ${LVMBLIB}/lvmbuilder-modules
	clean_basedev
	mount $BASEDEV $BUILDPLACE
	trap unmount_basedev exit
	pbuilder "$OP" "${PBCMDLINE[@]}"
	;;
    --update|update)
	. ${LVMBLIB}/lvmbuilder-checkparams
	. ${LVMBLIB}/lvmbuilder-modules
	mount $BASEDEV $BUILDPLACE
	trap unmount_basedev exit
	pbuilder "$OP" "${PBCMDLINE[@]}"
	;;
    --clean|clean)
	. ${LVMBLIB}/lvmbuilder-checkparams
	. ${LVMBLIB}/lvmbuilder-modules
	clean_basedev
	. /usr/lib/pbuilder/pbuilder-checkparams
	if [ -n "$APTCACHE" ]; then
	    echo "Cleaning [$APTCACHE]"
	    clean_subdirectories "$APTCACHE" || true
	fi
	;;
    --build|build|--login|login|--execute|execute)
	. ${LVMBLIB}/lvmbuilder-checkparams
	. ${LVMBLIB}/lvmbuilder-modules
    	setup_workplace
    	trap takedown_workplace exit
	pbuilder "$OP" "${PBCMDLINE[@]}"
	;;
    --dumpconfig|dumpconfig)
	. ${LVMBLIB}/lvmbuilder-checkparams
	. ${LVMBLIB}/lvmbuilder-modules
	echo " -> start dump config"
	echo "  -> set"
	set;
	echo "  -> env"
	env;
	echo " -> end dump config"
	;;
    --debuild|debuild)
	echo "E: The debuild mode of pbuilder is currently not supported by lvmbuilder."  >&2
	exit 1
	;;
    *)
	. ${LVMBLIB}/lvmbuilder-modules
	showhelp
	;;
esac