[494] | 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 | PARTITIONS=/root/price/partitions/testpart |
---|
| 9 | |
---|
| 10 | #losetup is crazy. pick a free loop device. see /usr/sbin/s-x-lvcopy for code. |
---|
| 11 | LODEV=/dev/loopNN-this-is-not-valid |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | VOLUME=/dev/xenvg/d_$HOSTNAME_hda |
---|
| 16 | DEST=/srv/$HOSTNAME/ |
---|
| 17 | |
---|
| 18 | sfdisk -f $VOLUME <$PARTITIONS |
---|
| 19 | losetup -o $(( 7903980 * 512 )) $LODEV $VOLUME |
---|
| 20 | mkswap $LODEV |
---|
| 21 | losetup -d $LODEV |
---|
| 22 | losetup -o $(( 63 * 512 )) $LODEV $VOLUME |
---|
| 23 | mkfs.ext3 -b 1024 $LODEV $(( 7903917 / 2 )) |
---|
| 24 | mkdir -p $DEST |
---|
| 25 | mount $LODEV $DEST |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | time debootstrap --arch amd64 etch "$DEST" http://debian.lcs.mit.edu/debian |
---|
| 29 | |
---|
| 30 | cp -a $SRC/fstab $DEST/etc/fstab |
---|
| 31 | cp -a $SRC/interfaces $DEST/etc/network/interfaces |
---|
| 32 | cp -a $SRC/sources.list $DEST/etc/apt/sources.list |
---|
| 33 | cp -a $SRC/update-grub.diff $DEST/root/update-grub.diff |
---|
| 34 | echo $HOSTNAME > $DEST/etc/hostname |
---|
| 35 | sed s/$SRCHOSTNAME/$HOSTNAME/g $SRC/hosts > $DEST/etc/hosts |
---|
| 36 | |
---|
| 37 | mount -t proc proc $DEST/proc |
---|
| 38 | |
---|
| 39 | LANG=C chroot "$DEST" <<ENDCHROOT |
---|
| 40 | |
---|
| 41 | export TERM=xterm-color |
---|
| 42 | mount -a |
---|
| 43 | |
---|
| 44 | cd /media |
---|
| 45 | mkdir cdrom0 |
---|
| 46 | ln -s cdrom0 cdrom |
---|
| 47 | cd / |
---|
| 48 | ln -s media/cdrom |
---|
| 49 | |
---|
| 50 | echo $'y\n3\nEastern' | tzconfig |
---|
| 51 | export DEBIAN_FRONTEND=noninteractive |
---|
| 52 | |
---|
| 53 | echo 'locales locales/locales_to_be_generated multiselect en_US ISO-8859-1' | debconf-set-selections |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | aptitude update |
---|
| 57 | aptitude -y install locales linux-image-xen-amd64 |
---|
| 58 | aptitude --without-recommends -y install ~pstandard ~prequired ~pimportant |
---|
| 59 | #strace tasksel install standard 2>&1 | less |
---|
| 60 | aptitude clean |
---|
| 61 | |
---|
| 62 | mkdir /boot/grub |
---|
| 63 | aptitude install grub |
---|
| 64 | patch /usr/sbin/update-grub </root/update-grub.diff |
---|
| 65 | update-grub |
---|
| 66 | patch /boot/grub/menu.lst </root/menu.lst.diff |
---|
| 67 | patch /etc/inittab </root/inittab.diff |
---|
| 68 | |
---|
| 69 | rm /root/update-grub.diff |
---|
| 70 | ENDCHROOT |
---|
| 71 | |
---|
| 72 | ## kill atd and rpc.statd that are using $DEST |
---|
| 73 | umount $DEST/proc |
---|
| 74 | umount $DEST |
---|
| 75 | losetup -d $LODEV |
---|