makedist/obsoleted/qemu.sh
2011-05-04 02:30:35 +02:00

70 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
#
# qemu.sh - Qemu test script for generated targets
#
# Copyright (c) 2005-2007 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
. ./VERSION
. ./functions.inc.sh
. ./defs.inc.sh
qemu_me="${0##*/}"
function usage() {
echo "\
usage: $qemu_me target [bootdrive [media] ]
target: makecd target name
bootdrive: drive to boot system from
(a=floppy,c=hard disk,d=iso image [default])
media: media to boot from (e.g. cd1 or dvd1); default is cd1
Example:
$qemu_me desktop d cd1
" >&2
}
[ "$1" ] || {
usage
exit 1
}
[ -d $TOPDIR/targets/$1 ] || {
echo "Error: specified target does not exist. Aborting."
exit 2
}
MAKEDIST_TARGET=$1
TARGETDIR=$TOPDIR/targets/$MAKEDIST_TARGET
[ "$2" ] && BOOTDEVICE=$2 || BOOTDEVICE=d
[ "$BOOTDEVICE" = "d" ] && [ "$3" ] && MEDIA=$3 || MEDIA=cd1
#
# load some target specific settings
. $TARGETDIR/settings.inc
if [ "$MEDIA" ]; then
DISKTAG=$MAKEDIST_TARGET-$MEDIA
else
DISKTAG=$MAKEDIST_TARGET
fi
[ -e "$LOCALSTATEDIR/qemu.img" ] || qemu-img create $LOCALSTATEDIR/qemu.img 10G
qemu \
-cdrom $LOCALSTATEDIR/QiLinux-$DISKTAG.$arch.iso \
-hda $LOCALSTATEDIR/qemu.img \
-boot $BOOTDEVICE