Compare commits

..

No commits in common. "5a2233bd04df6d728f879864aecc1de018e111fa" and "4b239c4e58322b425acd6de8ef51320f44644755" have entirely different histories.

8 changed files with 20 additions and 40 deletions

View file

@ -40,7 +40,7 @@ SRC_C_SOURCES_NAMES := $(notdir $(basename $(wildcard $(SRCD)/*$(SRC_FMT))))
C_BINARIES := $(addprefix $(QEMU_BIN)/,$(SRC_C_SOURCES_NAMES)) C_BINARIES := $(addprefix $(QEMU_BIN)/,$(SRC_C_SOURCES_NAMES))
# Directories in ~qemu necessary for qemush to work # Directories in ~qemu necessary for qemush to work
QEMUSH_DIRS_NAMES := bin launchers disks sockets/monitors sockets/spice QEMUSH_DIRS_NAMES := bin launchers disks sockets
QEMUSH_DIRS := $(addprefix $(QEMU_HOME)/,$(QEMUSH_DIRS_NAMES)) QEMUSH_DIRS := $(addprefix $(QEMU_HOME)/,$(QEMUSH_DIRS_NAMES))
install: $(QEMUSH_DIRS) $(MODULES) $(C_BINARIES) $(QEMUSH) $(LAUNCHERS) install: $(QEMUSH_DIRS) $(MODULES) $(C_BINARIES) $(QEMUSH) $(LAUNCHERS)

View file

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/bin/bash
# version=0.5.0 # version=0.4.1
# Function to re-exec the script as another user via sudo (only if needed) # Function to re-exec the script as another user via sudo (only if needed)
exec_as() { exec_as() {
@ -87,7 +87,7 @@ public_attach() {
public_running() { public_running() {
cd || return cd || return
echo "Running machines:" echo "Running machines:"
set -- $ls -t sockets/monitors "$@" set -- $ls -t sockets "$@"
exec "$@" exec "$@"
} }

View file

@ -1,8 +0,0 @@
#!/bin/sh -e
# Read configuration
sourceconf() { [ -r "$1" ] && . "$1"; }
sourceconf ./conf
# Delete socket and PID file
exec rm -f "$socket" "${socket}.pid"

View file

@ -1,13 +1,7 @@
#!/bin/sh -e #!/bin/sh -e
# Read configuration
sourceconf() {
[ -r "$1" ] && . "$1"
}
sourceconf ./conf
# Start a virtiofsd sharing qemu shared dir # Start a virtiofsd sharing qemu shared dir
exec /usr/lib/virtiofsd \ exec /usr/lib/virtiofsd \
--shared-dir "$shared_dir" \ --shared-dir ~qemu/shared \
--socket-path "$socket" \ --socket-path /run/virtiofsd.sock \
--socket-group qemu --socket-group qemu

View file

@ -1,5 +1,4 @@
#!/usr/bin/env sh #!/bin/sh -e
set -e
# Invoked on termination if the last command failed # Invoked on termination if the last command failed
error() { >&2 echo "$(basename "$0"): ${*}"; } error() { >&2 echo "$(basename "$0"): ${*}"; }
@ -18,10 +17,11 @@ case "$1" in
extension=qcow2 extension=qcow2
;; ;;
socket) socket)
basedir=sockets/monitors basedir=sockets
;; ;;
spice) spice)
basedir=sockets/spice basedir=spice
extension=sock
;; ;;
*) *)
false false
@ -33,7 +33,5 @@ trap - EXIT
# Print the actual string # Print the actual string
basedir="${HOME}/${basedir}" basedir="${HOME}/${basedir}"
name="$QEMUSH_NAME"
[ -n "$2" ] && name="${name}-${2}"
[ -n "$extension" ] && extension=".${extension}" [ -n "$extension" ] && extension=".${extension}"
printf %s/%s%s\\n "$basedir" "$name" "$extension" printf %s/%s%s\\n "$basedir" "$QEMUSH_NAME" "$extension"

View file

@ -26,6 +26,7 @@ command = [
'-M', 'q35', '-M', 'q35',
'-cpu', 'host', '-smp', nproc, '-cpu', 'host', '-smp', nproc,
'-m', ram, '-m', ram,
'-net', 'nic'
] + argv[1:] ] + argv[1:]
# Print the final command and replace the main process with it # Print the final command and replace the main process with it

View file

@ -1,12 +1,8 @@
#!/bin/sh -x #!/bin/sh -x
base=$(echo "$QEMUSH_BASE" | cut -d , -f 1) exec "$QEMUSH_BASE" \
QEMUSH_BASE=$(echo "$QEMUSH_BASE" | cut -d , -f 2-)
exec "$base" \
-vga qxl \ -vga qxl \
-chardev spicevmc,id=vdagent,debug=0,name=vdagent \ -chardev spicevmc,id=vdagent,debug=0,name=vdagent \
-device virtio-serial \ -device virtio-serial \
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \ -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
-spice port="$(first-free-port 5900)",addr=::1,disable-ticketing=on \ -spice port="$(first-free-port 5900)",addr=127.0.0.1,disable-ticketing=on \
-audiodev spice,id=snd0 \
"$@" "$@"

View file

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