aboutsummaryrefslogtreecommitdiff
path: root/pbuilder-user-mode-linux
blob: 961ce20f74ddbccabf6ba0d72738aad08eb29f32 (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
#! /bin/bash
# common modules for pbuilder.
#   pbuilder -- personal Debian package builder
#   Copyright (C) 2001,2002 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
#

# use this script file to bootstrap the pbuilder inside the UML
INSIDE_PBUILDER=$(tempfile)
MY_ETH0=tuntap,,,192.168.30.62
UML_IP=192.168.30.199
UML_NETMASK=192.168.30.199
UML_NETWORK=192.168.30.199
UML_BROADCAST=192.168.30.199
UML_GATEWAY=192.168.30.199
PBUILDER_UML_IMAGE="/tmp/uml"
BUILDING_DSC_FILE="$1"

cat <<EOF > ${INSIDE_PBUILDER}
#! /bin/bash
mount -t proc /proc /proc
mount -t tmpfs /tmp /tmp
mkdir /tmp/ubd1
mount -t ext2 /dev/ubd/1 /tmp/ubd1
mount -t tmpfs /tmp/ubd1/tmp /tmp/ubd1/tmp

cat <<IP > /tmp/ubd1/etc/network/interfaces
auto lo
iface lo inet loopback

# The first network card - this entry was created during the Debian installation
auto eth0
iface eth0 inet static
        address $UML_IP
        netmask $UML_NETMASK
        network $UML_NETWORK
        broadcast $UML_BROADCAST
        gateway $UML_GATEWAY

IP
cat <<SHELL > /tmp/ubd1/tmp/chrootshell
#! /bin/bash
# the shell executed inside chroot inside UML
/etc/init.d/networking start
SHELL
chmod a+x /tmp/ubd1/tmp/chrootshell
chroot /tmp/ubd1/ /tmp/chrootshell
pbuilder build --buildplace /tmp/ubd1/ --internal-build-uml ${BUILDING_DSC_FILE} 
EOF

chmod a+x ${INSIDE_PBUILDER}

linux eth0=${MY_ETH0} mem=100M con0=fd:0,fd:1 con=pty ubd0=/ ubd1=${PBUILDER_UML_IMAGE} devfs=mount init=${INSIDE_PBUILDER}