Compare commits

..

No commits in common. "b1f544a190c03294d94ba338b7c81e4ffd61e061" and "bbf59bab0b0a98cedd11a423e59b92fe60ee513e" have entirely different histories.

3 changed files with 6 additions and 22 deletions

View file

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# version=0.7.0 # version=0.6.1
# Re-exec the script as qemu via sudo (only if needed) # Re-exec the script as qemu via sudo (only if needed)
[ "$(whoami)" != qemu ] && exec sudo -E -H -u qemu -- "$0" "$@" [ "$(whoami)" != qemu ] && exec sudo -E -H -u qemu -- "$0" "$@"
@ -40,7 +40,6 @@ ${name}: usage:
${name} help - show this help ${name} help - show this help
${name} add <path to script> [<VM name>] - add a launching script ${name} add <path to script> [<VM name>] - add a launching script
${name} do <command> - run shell input as user qemu ${name} do <command> - run shell input as user qemu
${name} spice <running VM> [<TCP port>] - expose a SPICE socket to TCP
EOF EOF
} }
@ -167,19 +166,6 @@ public_do() {
exec sh -c "$*" exec sh -c "$*"
} }
# Expose SPICE via TCP
public_spice() {
QEMUSH_NAME="$1"
if [ -n "$2" ]; then
port=$2
else
port=$(first-free-port 5900)
fi
exec tmux new -d -s "TCP port ${port} -> ${QEMUSH_NAME}" \
socat TCP-LISTEN:"${port},reuseaddr,fork" UNIX-CLIENT:"$(pathof spice)"
}
# Retrieve user requested function # Retrieve user requested function
function="$1" function="$1"
shift shift

View file

@ -25,4 +25,5 @@ my @command = (
); );
print "+ exec ", join(" ", @command), "\n"; print "+ exec ", join(" ", @command), "\n";
exit;
exec @command; exec @command;

View file

@ -1,19 +1,16 @@
#!/usr/bin/env sh #!/bin/sh -x
export QEMUSH_RAM=4G export QEMUSH_RAM=4G
export QEMUSH_BASE=kvm export QEMUSH_BASE=virtiofs,kvm
[ -z "$QEMUSH_NAME" ] && { [ -z "$QEMUSH_NAME" ] && {
export QEMUSH_NAME export QEMUSH_NAME
QEMUSH_NAME=$(basename "$0") QEMUSH_NAME=$(basename "$0")
} }
# Launch the virtual machine # Launch the virtual machine
set -- spice \ exec spice \
-drive file="$(pathof disk)",if=virtio \ -drive file="$(pathof disk)",if=virtio \
-net nic -net user,hostname="${QEMUSH_NAME}" \ -net nic -net user,hostname="${QEMUSH_NAME}" \
-usbdevice tablet \ -usbdevice tablet \
-name "$QEMUSH_NAME" \
-device intel-hda -device hda-duplex,audiodev=snd0 \ -device intel-hda -device hda-duplex,audiodev=snd0 \
"$@" "$@"
# Execute the machine
set -x
exec "$@"