#!/bin/bash

[ -x "`which screen`" ] || exit
[ -x "`which qemu`" ] || exit

[ -f "$1" ] && IMAGE=$1 || exit
[ -n "$2" ] && PORT=$2 || exit

screen -d -m qemu -hda $1 -user-net -nographic -redir tcp:$2::22

echo System started
echo Type \'screen -r\' to use the serial console
echo Type \'ssh -l root -p $PORT localhost\' to login via ssh

