aboutsummaryrefslogtreecommitdiff
path: root/pbuilder
blob: 54cebb3c9ac35b67d6a0c0b6d50c8d7755636db8 (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
#! /bin/bash
#   pbuilder -- personal Debian package builder
#   Copyright (C) 2001-2004 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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"

case "$1" in
    create)
	shift;
	/usr/lib/pbuilder/pbuilder-createbuildenv "$@"
	;;
    update)
	shift ;
	/usr/lib/pbuilder/pbuilder-updatebuildenv "$@"
	;;
    build)
	shift ;
	/usr/lib/pbuilder/pbuilder-buildpackage "$@"
	;;
    clean)
	shift;
	. /usr/lib/pbuilder/pbuilder-checkparams
	if [ -n "$BASEBUILDPLACE" ]; then 
	    echo "Cleaning [$BASEBUILDPLACE]"
	    clean_subdirectories "$BASEBUILDPLACE" || true
	fi
	if [ -n "$APTCACHE" ]; then
	    echo "Cleaning [$APTCACHE]"
	    clean_subdirectories "$APTCACHE" || true
	fi
	;;
    login)
	shift 
	. /usr/lib/pbuilder/pbuilder-checkparams
	. /usr/lib/pbuilder/pbuilder-runhooks
	extractbuildplace
	trap umountproc_cleanbuildplace exit
	loadhooks
	if [ "${INTERNAL_BUILD_UML}" = "yes" ]; then
	    echo " -> entering the shell"
	else
	    echo " -> entering the shell
File extracted to: $BUILDPLACE
"
	fi
	executehooks "F"
	chroot "$BUILDPLACE" bin/bash
	;;
    execute)
	# try to execute arbitrary program.
	shift
	. /usr/lib/pbuilder/pbuilder-checkparams
	. /usr/lib/pbuilder/pbuilder-runhooks
	EXECPROGRAM="$1"
	shift
	if [ ! -f "${EXECPROGRAM}" ]; then
	    echo "Command line parameter [$EXECPROGRAM] does not exist" >&2
	    exit 1;
	fi;
	extractbuildplace
	trap umountproc_cleanbuildplace exit
	loadhooks
	RUNNAME="$BUILDPLACE/run"
	cat "$EXECPROGRAM" > "$RUNNAME"
	chmod a+x "$RUNNAME"
	executehooks "F"
	chroot "$BUILDPLACE" /run "$@"
	;;
    dumpconfig)
	shift
	. /usr/lib/pbuilder/pbuilder-checkparams
	. /usr/lib/pbuilder/pbuilder-runhooks
	extractbuildplace
	trap umountproc_cleanbuildplace exit
	loadhooks
	executehooks "F"
	echo " -> start dump config"
	echo "  -> set"
	set;
	echo "  -> env"
	env;
	echo " -> end dump config"
	;;
    *)
	. /usr/lib/pbuilder/pbuilder-modules
	showhelp
	;;
esac