Skip to content

Instantly share code, notes, and snippets.

@mkuron
Created March 23, 2014 15:37
Show Gist options
  • Save mkuron/9724783 to your computer and use it in GitHub Desktop.
Save mkuron/9724783 to your computer and use it in GitHub Desktop.
QEMU Debian Netinst
#!/bin/bash
cd $(dirname $0)
arch=powerpc
ram=256
dist=jessie
mirror='http://ftp.de.debian.org/debian'
disk=debian-$dist-$arch.qcow2
initrd=initrd.gz
case "$arch" in
"amd64")
qemu=qemu-system-x86_64
kernel=linux
download="$mirror/dists/$dist/main/installer-$arch/current/images/netboot/debian-installer/$arch/{$kernel,$initrd}"
;;
"i386")
qemu=qemu-system-$arch
kernel=linux
download="$mirror/dists/$dist/main/installer-$arch/current/images/netboot/debian-installer/$arch/{$kernel,$initrd}"
;;
"powerpc"|"powerpc64")
qemu=qemu-system-ppc${arch:7}
kernel=vmlinux
download="$mirror/dists/$dist/main/installer-${arch:0:7}/current/images/$arch/netboot/{$kernel,$initrd}"
;;
esac
if [ ! -f $disk ]; then
echo "Creating $disk"
qemu-img create -f qcow2 $disk 4G
fi
if [ "$(stat -f %z $disk)" -lt 1000000 ]; then
if [ ! -f $kernel -o ! -f initrd.gz ]; then
echo "Downloading $dist $arch NetInstall"
curl -LO $download
fi
echo 'Booting Netinstall'
$qemu -m $ram -kernel $kernel -initrd initrd.gz -hda $disk -append "root=/dev/ram"
exit
fi
$qemu -m $ram -hda $disk -boot order=c -redir tcp:2222::22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment