Eric's and my debootstrap work from the hackathon
authorGreg Price <price@mit.edu>
Sun, 4 May 2008 00:53:31 +0000 (20:53 -0400)
committerGreg Price <price@mit.edu>
Sun, 4 May 2008 00:53:31 +0000 (20:53 -0400)
svn path=/trunk/packages/sipb-xen-guest-installer/; revision=494

partial/debootstrap-commands [new file with mode: 0644]
partial/debootstrap.d/fstab [new file with mode: 0644]
partial/debootstrap.d/hosts [new file with mode: 0644]
partial/debootstrap.d/inittab.diff [new file with mode: 0644]
partial/debootstrap.d/interfaces [new file with mode: 0644]
partial/debootstrap.d/menu.lst.diff [new file with mode: 0644]
partial/debootstrap.d/sources.list [new file with mode: 0644]
partial/debootstrap.d/update-grub.diff [new file with mode: 0644]

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
diff --git a/partial/debootstrap.d/fstab b/partial/debootstrap.d/fstab
new file mode 100644 (file)
index 0000000..a8e6243
--- /dev/null
@@ -0,0 +1,7 @@
+# /etc/fstab: static file system information.
+#
+# <file system> <mount point>   <type>  <options>       <dump>  <pass>
+proc            /proc           proc    defaults        0       0
+/dev/hda1       /               ext3    defaults,errors=remount-ro 0       1
+/dev/hda5       none            swap    sw              0       0
+/dev/hdc        /media/cdrom0   udf,iso9660 user,noauto     0       0
diff --git a/partial/debootstrap.d/hosts b/partial/debootstrap.d/hosts
new file mode 100644 (file)
index 0000000..da2afa1
--- /dev/null
@@ -0,0 +1,10 @@
+127.0.0.1       localhost
+127.0.1.1       moo17.servers.csail.mit.edu     moo17
+
+# The following lines are desirable for IPv6 capable hosts
+::1     ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+ff00::0 ip6-mcastprefix
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+ff02::3 ip6-allhosts
diff --git a/partial/debootstrap.d/inittab.diff b/partial/debootstrap.d/inittab.diff
new file mode 100644 (file)
index 0000000..0745ff9
--- /dev/null
@@ -0,0 +1,11 @@
+--- inittab.orig       2008-04-22 05:42:50.000000000 -0400
++++ inittab    2008-04-22 05:43:04.000000000 -0400
+@@ -60,7 +60,7 @@
+ # Example how to put a getty on a serial line (for a terminal)
+ #
+-#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
++T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
+ #T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
+ # Example how to put a getty on a modem line.
diff --git a/partial/debootstrap.d/interfaces b/partial/debootstrap.d/interfaces
new file mode 100644 (file)
index 0000000..04ee0fe
--- /dev/null
@@ -0,0 +1,10 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+allow-hotplug eth0
+iface eth0 inet dhcp
diff --git a/partial/debootstrap.d/menu.lst.diff b/partial/debootstrap.d/menu.lst.diff
new file mode 100644 (file)
index 0000000..da16aa0
--- /dev/null
@@ -0,0 +1,11 @@
+--- menu.lst.orig      2008-04-22 05:41:32.000000000 -0400
++++ menu.lst   2008-04-22 05:42:15.000000000 -0400
+@@ -59,7 +59,7 @@
+ ## e.g. kopt=root=/dev/hda1 ro
+ ##      kopt_2_6_8=root=/dev/hdc1 ro
+ ##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
+-# kopt=root=/dev/hda1 ro
++# kopt=root=/dev/hda1 ro console=ttyS0,9600,8n1
+ ## default grub root device
+ ## e.g. groot=(hd0,0)
diff --git a/partial/debootstrap.d/sources.list b/partial/debootstrap.d/sources.list
new file mode 100644 (file)
index 0000000..e2b2d67
--- /dev/null
@@ -0,0 +1,6 @@
+
+deb http://debian.lcs.mit.edu/debian/ etch main
+deb-src http://debian.lcs.mit.edu/debian/ etch main
+
+deb http://security.debian.org/ etch/updates main
+deb-src http://security.debian.org/ etch/updates main
diff --git a/partial/debootstrap.d/update-grub.diff b/partial/debootstrap.d/update-grub.diff
new file mode 100644 (file)
index 0000000..c420c89
--- /dev/null
@@ -0,0 +1,15 @@
+--- update-grub.orig   2008-04-22 01:13:34.000000000 -0400
++++ update-grub        2008-04-22 01:13:13.000000000 -0400
+@@ -1036,10 +1036,10 @@
+       if [ ! "$in_domU" ] && [ "$is_xen" ]; then
+         # skip xen kernels
+-          continue
++        :
+         elif [ "$in_domU" ] && ! [ "$is_xen" ]; then
+         # skip non-xen kernels
+-        continue
++        :
+         fi
+         kern="/boot/$kern"
+       newerKernels=""