summaryrefslogtreecommitdiff
path: root/run-bootstrap-in-chroot
blob: cdef958865814720254073bcbffabf04da9f685a (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
#!/bin/sh

set -e

export LC_ALL=C

if [ "x$1" = x ]
then
    dir="squeeze-chroot"
else
    dir="$1"
fi
mirror="http://192.168.1.185/debian"

umount "$dir/proc" || true
umount "$dir/sys" || true
rm -rf "$dir"
mkdir "$dir"

debootstrap \
--include=build-essential,\
gawk,bison,python,autoconf,autopoint,automake,gettext,libtool,\
help2man,texinfo,sudo,qemu-utils,parted,kpartx,mbr,extlinux \
squeeze "$dir" "$mirror"

hostname > "$dir/etc/hostname"
cat <<EOF > "$dir/etc/hosts"
127.0.0.1   localhost
127.0.1.1   $(hostname)
EOF

cp baserock-bootstrap "$dir/."
mkdir -p "$dir/tree/baserock"
cp -r "$HOME/baserock/gits" "$dir/tree/baserock/gits"
sed 's,^.*/,http://192.168.1.185/lfs/,' wget-list > "$dir/wget-list"
mount -t proc proc "$dir/proc"
mount -t sysfs sysfs "$dir/sys"
if chroot "$dir" bash -x baserock-bootstrap no
then
    exit=0
else
    exit=$?
fi
umount "$dir/sys"
umount "$dir/proc"
exit $exit