Eric's and my debootstrap work from the hackathon
[invirt/packages/invirt-autoinstaller.git] / partial / debootstrap-commands
diff --git a/partial/debootstrap-commands b/partial/debootstrap-commands
new file mode 100644 (file)
index 0000000..9975e7b
--- /dev/null
@@ -0,0 +1,75 @@
+#http://www.debian.org/releases/stable/i386/apds03.html.en
+
+SRC=/root/debootstrap.d
+SRCHOSTNAME=moo17
+#HOSTNAME=debootstrap-test
+#pick a hostname!
+
+PARTITIONS=/root/price/partitions/testpart
+
+#losetup is crazy.  pick a free loop device.  see /usr/sbin/s-x-lvcopy for code.
+LODEV=/dev/loopNN-this-is-not-valid
+
+
+
+VOLUME=/dev/xenvg/d_$HOSTNAME_hda
+DEST=/srv/$HOSTNAME/
+
+sfdisk -f $VOLUME <$PARTITIONS
+losetup -o $(( 7903980 * 512 )) $LODEV $VOLUME
+mkswap $LODEV
+losetup -d $LODEV
+losetup -o $(( 63 * 512 )) $LODEV $VOLUME
+mkfs.ext3 -b 1024 $LODEV $(( 7903917 / 2 ))
+mkdir -p $DEST
+mount $LODEV $DEST
+
+
+time debootstrap --arch amd64 etch "$DEST" http://debian.lcs.mit.edu/debian
+
+cp -a $SRC/fstab $DEST/etc/fstab
+cp -a $SRC/interfaces $DEST/etc/network/interfaces
+cp -a $SRC/sources.list $DEST/etc/apt/sources.list
+cp -a $SRC/update-grub.diff $DEST/root/update-grub.diff
+echo $HOSTNAME > $DEST/etc/hostname
+sed s/$SRCHOSTNAME/$HOSTNAME/g $SRC/hosts > $DEST/etc/hosts
+
+mount -t proc proc $DEST/proc
+
+LANG=C chroot "$DEST" <<ENDCHROOT
+
+export TERM=xterm-color
+mount -a
+
+cd /media
+mkdir cdrom0
+ln -s cdrom0 cdrom
+cd /
+ln -s media/cdrom
+
+echo $'y\n3\nEastern' | tzconfig
+export DEBIAN_FRONTEND=noninteractive
+
+echo 'locales locales/locales_to_be_generated multiselect     en_US ISO-8859-1' | debconf-set-selections
+
+
+aptitude update
+aptitude -y install locales linux-image-xen-amd64
+aptitude --without-recommends -y install ~pstandard ~prequired ~pimportant
+#strace tasksel install standard 2>&1 | less
+aptitude clean
+
+mkdir /boot/grub
+aptitude install grub
+patch /usr/sbin/update-grub </root/update-grub.diff
+update-grub
+patch /boot/grub/menu.lst </root/menu.lst.diff
+patch /etc/inittab </root/inittab.diff
+
+rm /root/update-grub.diff
+ENDCHROOT
+
+## kill atd and rpc.statd that are using $DEST
+umount $DEST/proc
+umount $DEST
+losetup -d $LODEV