1 | #http://www.debian.org/releases/stable/i386/apds03.html.en |
---|
2 | |
---|
3 | SRC=/root/debootstrap.d |
---|
4 | SRCHOSTNAME=moo17 |
---|
5 | #HOSTNAME=debootstrap-test |
---|
6 | #pick a hostname! |
---|
7 | |
---|
8 | DIST=etch |
---|
9 | |
---|
10 | PARTITIONS=/root/price/partitions/testpart |
---|
11 | |
---|
12 | #losetup is crazy. pick a free loop device. see /usr/sbin/s-x-lvcopy for code. |
---|
13 | |
---|
14 | VOLUME=/dev/xenvg/d_$HOSTNAME_hda |
---|
15 | #DEST=/srv/$HOSTNAME/ |
---|
16 | |
---|
17 | ### |
---|
18 | ### Create the device for SIPB-Xen purposes |
---|
19 | ### |
---|
20 | sfdisk -f $VOLUME <$PARTITIONS |
---|
21 | SWAPDEV=$(sipb-xen-losetup $VOLUME $(( 7903980 * 512 ))) |
---|
22 | #mkswap $SWAPDEV |
---|
23 | #losetup -d $LODEV |
---|
24 | IMAGEDEV=$(sipb-xen-losetup $VOLUME $(( 63 * 512 ))) |
---|
25 | # mkfs.ext3 -b 1024 $IMAGEDEV $(( 7903917 / 2 )) |
---|
26 | |
---|
27 | # mkdir -p $DEST |
---|
28 | # mount $LODEV $DEST |
---|
29 | |
---|
30 | CREATE_IMAGE_CONFIG=./paravm-create.conf |
---|
31 | |
---|
32 | xen-create-image --image-dev $IMAGEDEV --swap-dev $SWAPDEV --fs ext3 --config $CREATE_IMAGE_CONFIG \ |
---|
33 | --dist $DIST --hostname $HOSTNAME |
---|
34 | |
---|
35 | # xen-create-image --image-dev $IMAGEDEV --swap-dev $SWAPDEV --fs ext3 --ide --arch amd64 --dist etch --hostname moo19 --mirror http://debian.lcs.mit.edu/debian --ip=18.181.0.186 --netmask=255.255.0.0 --gateway=18.181.0.1 --cache |
---|
36 | |
---|
37 | losetup -d $SWAPDEV |
---|
38 | losetup -d $IMAGEDEV |
---|
39 | |
---|
40 | time debootstrap --arch amd64 etch "$DEST" http://debian.lcs.mit.edu/debian |
---|
41 | |
---|
42 | cp -a $SRC/fstab $DEST/etc/fstab |
---|
43 | cp -a $SRC/interfaces $DEST/etc/network/interfaces |
---|
44 | cp -a $SRC/sources.list $DEST/etc/apt/sources.list |
---|
45 | cp -a $SRC/update-grub.diff $DEST/root/update-grub.diff |
---|
46 | echo $HOSTNAME > $DEST/etc/hostname |
---|
47 | sed s/$SRCHOSTNAME/$HOSTNAME/g $SRC/hosts > $DEST/etc/hosts |
---|
48 | |
---|
49 | mount -t proc proc $DEST/proc |
---|
50 | |
---|
51 | LANG=C chroot "$DEST" <<ENDCHROOT |
---|
52 | |
---|
53 | export TERM=xterm-color |
---|
54 | mount -a |
---|
55 | |
---|
56 | cd /media |
---|
57 | mkdir cdrom0 |
---|
58 | ln -s cdrom0 cdrom |
---|
59 | cd / |
---|
60 | ln -s media/cdrom |
---|
61 | |
---|
62 | echo $'y\n3\nEastern' | tzconfig |
---|
63 | export DEBIAN_FRONTEND=noninteractive |
---|
64 | |
---|
65 | echo 'locales locales/locales_to_be_generated multiselect en_US ISO-8859-1' | debconf-set-selections |
---|
66 | |
---|
67 | |
---|
68 | aptitude update |
---|
69 | aptitude -y install locales linux-image-xen-amd64 |
---|
70 | aptitude --without-recommends -y install ~pstandard ~prequired ~pimportant |
---|
71 | #strace tasksel install standard 2>&1 | less |
---|
72 | aptitude clean |
---|
73 | |
---|
74 | mkdir /boot/grub |
---|
75 | aptitude install grub |
---|
76 | patch /usr/sbin/update-grub </root/update-grub.diff |
---|
77 | update-grub |
---|
78 | patch /boot/grub/menu.lst </root/menu.lst.diff |
---|
79 | patch /etc/inittab </root/inittab.diff |
---|
80 | |
---|
81 | rm /root/update-grub.diff |
---|
82 | ENDCHROOT |
---|
83 | |
---|
84 | ## kill atd and rpc.statd that are using $DEST |
---|
85 | umount $DEST/proc |
---|
86 | umount $DEST |
---|
87 | losetup -d $LODEV |
---|