#!/bin/bash if [ ! -f "/usr/bin/qemu-system-i386" ] then sudo apt-get install qemu-system fi boot_img="http://archive.debian.org/debian/dists/etch/main/installer-i386/current/images/floppy/boot.img" root_img="http://archive.debian.org/debian/dists/etch/main/installer-i386/current/images/floppy/root.img" #make clean rm -fr root.img boot.img tmp echo "Getting Mini Debian Boot IMG File..." wget -c "$boot_img" echo "Pulling Kernel from IMG File..." mkdir tmp sudo mount boot.img tmp cp tmp/linux ./ sudo umount tmp echo "Getting Mini Debian RootFS IMG File..." wget -c "$root_img" echo "Mounting Root Image and Retrieving initrd..." sudo mount root.img tmp cp tmp/initrd.gz ./ sudo umount tmp #cleanup rm -fr root.img boot.img tmp mkdir rootfs cd rootfs zcat ../initrd.gz |cpio -i -H newc -d echo "Setting default shell for boot time..." cat << EOF > etc/inittab # /etc/inittab # busybox init configuration for debian-installer # main rc script ::sysinit:/bin/busybox sh # main setup program ::respawn:/sbin/poweroff # # # convenience shells vc/2::askfirst:-/bin/sh vc/3::askfirst:-/bin/sh # # logging vc/4::respawn:/usr/bin/tail -f /var/log/syslog # # # Stuff to do before rebooting ::ctrlaltdel:/sbin/shutdown > /dev/null 2>&1 # # re-exec init on receipt of SIGHUP/SIGUSR1 ::restart:/sbin/init EOF echo "Recompressing initrd IMG..." find | cpio -o -H newc | gzip -2 > ../initrd.gz cd ../ echo "Starting Qemu virtual machine..." qemu-system-i386 -kernel linux\ -initrd initrd.gz\ -append 'root=/dev/ram0 console=ttyS0 console=ttyS0 rw'\ -nographic