#!/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin #constants VOLUME=vg1 VOLUMEP=/dev/$VOLUME IP_FIRST_3_NR=192.168.3 IP_GATEWAY_LAST_NR=1 TMP_MNT=/mnt DEBIAN_RELEASE=sarge ARCH=i386 if [ "$1" = "--nice" ]; then NICE="--nice" shift else NICE="" fi UMLUSER=$1 IP_LAST_NR=$2 MEM=$3 DISKSPACE=$4 UMLIP=$IP_FIRST_3_NR.$IP_LAST_NR PARTITION=$VOLUMEP/$UMLUSER echo -n "creating partition" lvcreate -n $UMLUSER -L $DISKSPACE $VOLUME || exit mkreiserfs -ff $VOLUMEP/$UMLUSER || exit mount $VOLUMEP/$UMLUSER $TMP_MNT || exit echo "." echo "bootstrapping debian" debootstrap --arch $ARCH $DEBIAN_RELEASE $TMP_MNT || exit echo "." echo "modifying config" cd /; tar cf - etc/ssh | (cd $TMP_MNT; tar xf -) ; cd - cat /etc/apt/sources.list | sed s/sarge/$DEBIAN_RELEASE/g > $TMP_MNT/etc/apt/sources.list #fstab echo "/dev/udb0 / reiserfs defaults 0 0" > $TMP_MNT/etc/fstab echo "proc /proc proc defaults 0 0" >> $TMP_MNT/etc/fstab #networking echo "auto lo" >> $TMP_MNT/etc/network/interfaces echo "iface lo inet loopback" >> $TMP_MNT/etc/network/interfaces echo "auto eth0" >> $TMP_MNT/etc/network/interfaces echo "iface eth0 inet static" >> $TMP_MNT/etc/network/interfaces echo " address $UMLIP" >> $TMP_MNT/etc/network/interfaces echo " netmask 255.255.255.0" >> $TMP_MNT/etc/network/interfaces echo " network $IP_FIRST_3_NR.0" >> $TMP_MNT/etc/network/interfaces echo " gateway $IP_FIRST_3_NR.$IP_GATEWAY_LAST_NR" >> $TMP_MNT/etc/network/interfaces #hostname echo $UMLUSER > $TMP_MNT/etc/hostname #inittab: ctrl-alt-delete shall halt, disable ttys 3-6 cat $0 | patch -d $TMP_MNT/etc/ inittab #install ssh chroot $TMP_MNT apt-get update chroot $TMP_MNT apt-get install ssh #deactivate NTPL chroot $TMP_MNT mv /lib/tls /lib/tls.bak #set root password echo "please enter your root password:" chroot $TMP_MNT passwd umount $TMP_MNT #create the user adduser --no-create-home --ingroup uml-net --disabled-password --quiet $UMLUSER echo "/etc/init.d/uml-child.sh $NICE $UMLUSER $IP_LAST_NR $MEM $DISKSPACE \$@" > /etc/init.d/uml-$UMLUSER chmod a+x /etc/init.d/uml-$UMLUSER echo "To start this instance automatically on boot execute" echo "update-rc.d uml-$UMLUSER start 99 2 3 4 5 . stop 01 0 1 6 ." echo "Otherwiste use \"/etc/init.d/uml-$UMLUSER start\" to start the uml child" echo "and \"/etc/init.d/uml-$UMLUSER stop\" to stop the child" exit 0 # here starts the patch to inittab --- inittab Fri Jan 25 13:53:58 2002 +++ /root/tmp/etc/inittab Fri Jul 2 19:21:49 2004 @@ -30,7 +30,7 @@ z6:6:respawn:/sbin/sulogin # What to do when CTRL-ALT-DEL is pressed. -ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now +ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -h now # Action on special keypress (ALT-UpArrow). #kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work." @@ -53,10 +53,10 @@ # 1:2345:respawn:/sbin/getty 38400 tty1 2:23:respawn:/sbin/getty 38400 tty2 -3:23:respawn:/sbin/getty 38400 tty3 -4:23:respawn:/sbin/getty 38400 tty4 -5:23:respawn:/sbin/getty 38400 tty5 -6:23:respawn:/sbin/getty 38400 tty6 +#3:23:respawn:/sbin/getty 38400 tty3 +#4:23:respawn:/sbin/getty 38400 tty4 +#5:23:respawn:/sbin/getty 38400 tty5 +#6:23:respawn:/sbin/getty 38400 tty6 # Example how to put a getty on a serial line (for a terminal) #