summaryrefslogtreecommitdiff
path: root/osi-shell
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-08-16 17:20:19 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-08-16 17:20:19 -0400
commit6fc3d798272213ffbfaa526af748ffd0c94f5e62 (patch)
tree0b63d50282485f2c327e3e32c2fb34f8efa24382 /osi-shell
parent814fb5a60da22cca6f80e9efc53477609ab1b054 (diff)
osi-shell: Allow setting qemu args
Diffstat (limited to 'osi-shell')
-rwxr-xr-xosi-shell15
1 files changed, 8 insertions, 7 deletions
diff --git a/osi-shell b/osi-shell
index f8b6ee8..d282268 100755
--- a/osi-shell
+++ b/osi-shell
@@ -8,6 +8,8 @@ source ./lib/osi.sh
main() {
local arg_mode=main
+ local arg_image=
+ local arg_qemu=()
local args
if ! args="$(getopt -n "${0##*/}" -o hV -l help,version -- "$@")"; then
arg_mode=error
@@ -23,15 +25,12 @@ main() {
done
case "$arg_mode" in
main)
- if (( $# != 1 )); then
- if (( $# == 0 )); then
- error 0 "Expected 1 positional argument, got none"
- else
- error 0 "Expected 1 positional argument, got %d: %s" "$#" "${*@Q}"
- fi
+ if (( $# < 1 )); then
+ error 0 "Expected at least 1 positional argument, got none"
arg_mode=error
else
arg_image=$1
+ arg_qemu=("${@:2}")
fi
;;
esac
@@ -43,7 +42,8 @@ main() {
return 0
;;
usage)
- print 'Usage: %s [OPTIONS] FILENAME.img [< SCRIPT.sh]' "${0##*/}"
+ print 'Usage: %s [OPTIONS] FILENAME.img [-- QEMU_ARGS...] [< SCRIPT.sh]' "${0##*/}"
+ print ' or: %s [OPTIONS] -- FILENAME.img [QEMU_ARGS...] [< SCRIPT.sh]' "${0##*/}"
print 'Operating System Image: Interactive Shell'
echo
print 'OPTIONS:'
@@ -65,6 +65,7 @@ main() {
-drive media=disk,format=raw,if=virtio,file="$arg_image" \
-serial stdio \
-serial file:"$tmp/exit" \
+ "${arg_qemu[@]}" \
< <(cat <"$tmp/sync" >/dev/null; cat; while sleep 0.1; do printf '\x04'; done) \
> >(read -r -N1 c; printf '%s' "$c"; :>"$tmp/sync"; exec cat)