12
[ -e $image ] && echo $image exists && exit 1
13
dd if=/dev/zero of=$image bs=1M seek=1023 count=1
14
yes | mke2fs -j $image
17
mount -o loop $image $root
20
umount $root/proc || true
21
umount $root/sys || true
22
umount $root/dev/pts || true
25
trap cleanup INT TERM EXIT
27
debootstrap $dist $root http://http.us.debian.org/debian/
29
cat <<EOF >> $root/etc/fstab
30
none /dev/pts devpts gid=5,mode=620 0 0
31
proc /proc proc defaults 0 0
32
sysfs /sys sysfs defaults 0 0
33
none /sys/kernel/debug debugfs defaults 0 0
34
tmpfs /tmp tmpfs defaults,size=768M 0 0
35
none /host hostfs defaults 0 0
38
echo "uml" > $root/etc/hostname
42
mount -t proc proc $root/proc
43
mount -t sysfs sysfs $root/sys
44
mount -t devpts devptr $root/dev/pts -o gid=5,mode=620
47
cp $srcdir/network-from-cmdline $root/etc/init.d/network-from-cmdline
48
chroot $root update-rc.d network-from-cmdline defaults 20
51
cp $srcdir/kcon_most.sh $root/root/most.sh
52
cp $srcdir/kcon_all.sh $root/root/all.sh
55
cat <<EOF >> $root/etc/securetty
62
cat <<EOF >> $root/etc/inittab
64
# uml just one console
65
c0:1235:respawn:/sbin/getty 38400 tty0 linux
67
grep -v tty[23456] $root/etc/inittab > $root/etc/inittab.new
68
mv $root/etc/inittab.new $root/etc/inittab
71
chroot $root passwd -d root
73
# copy creating user's authorized_keys
75
chmod 700 $root/root/.ssh
76
cp ~/.ssh/authorized_keys $root/root/.ssh/authorized_keys
77
chmod 600 $root/root/.ssh/authorized_keys
80
chroot $root apt-get -y --force-yes install ssh libcrypto\+\+ bind9-host