toaruos/util/config-parser
2013-11-28 15:58:57 -08:00

57 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Set some defaults
RESOLUTION="1024x768"
ENABLE_KVM=true
EMU_MEMORY=1024
FULLSCREEN=false
ENABLE_SERIAL=true
ENABLE_GRAPHICS=true
BORDERLESS=true
SINGLE=false
DEBUG_SERIAL=false
# Load the config file
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -e "$DIR/../.config" ]; then
. "$DIR/../.config"
fi
# Parse some things
ENABLEKVM=""
if [ $ENABLE_KVM == true ]; then
ENABLEKVM="-enable-kvm"
fi
FULL_SCREEN=""
if [ $FULLSCREEN == true ]; then
FULL_SCREEN="-full-screen"
fi
SERIAL=""
if [ $ENABLE_SERIAL ]; then
SERIAL="-serial stdio"
fi
RESPARSED=`echo $RESOLUTION | sed 's/x/,,/'`
GRAPHICS="vid=qemu=$RESPARSED"
if [ $ENABLE_GRAPHICS == false ]; then
GRAPHICS="vgaterm"
fi
BORDERS="-no-frame"
if [ $BORDERLESS == false ]; then
BORDERS=""
fi
if [ $SINGLE == true ]; then
GRAPHICS="$GRAPHICS single"
fi
if [ $DEBUG_SERIAL == true ]; then
GRAPHICS="$GRAPHICS logtoserial=0"
fi
# Generate the QEMU arguments list
$1 -kernel toaruos-kernel -m $EMU_MEMORY $ENABLEKVM $FULL_SCREEN $SERIAL -vga std -rtc base=localtime -hda toaruos-disk.img -k en-us $BORDERS -append "$GRAPHICS hdd" -sdl