Compare commits
13 commits
4b239c4e58
...
5a2233bd04
Author | SHA1 | Date | |
---|---|---|---|
5a2233bd04 | |||
ab9adc1680 | |||
0f9b26937b | |||
52b584b926 | |||
75bb9b68f7 | |||
195a76cc4a | |||
f0769919c8 | |||
261e4b12be | |||
c7142146c6 | |||
7e1fbdae54 | |||
e00d57ce54 | |||
94819fd529 | |||
cf34f0499d |
8 changed files with 40 additions and 20 deletions
2
Makefile
2
Makefile
|
@ -40,7 +40,7 @@ SRC_C_SOURCES_NAMES := $(notdir $(basename $(wildcard $(SRCD)/*$(SRC_FMT))))
|
|||
C_BINARIES := $(addprefix $(QEMU_BIN)/,$(SRC_C_SOURCES_NAMES))
|
||||
|
||||
# Directories in ~qemu necessary for qemush to work
|
||||
QEMUSH_DIRS_NAMES := bin launchers disks sockets
|
||||
QEMUSH_DIRS_NAMES := bin launchers disks sockets/monitors sockets/spice
|
||||
QEMUSH_DIRS := $(addprefix $(QEMU_HOME)/,$(QEMUSH_DIRS_NAMES))
|
||||
|
||||
install: $(QEMUSH_DIRS) $(MODULES) $(C_BINARIES) $(QEMUSH) $(LAUNCHERS)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
# version=0.4.1
|
||||
#!/usr/bin/env bash
|
||||
# version=0.5.0
|
||||
|
||||
# Function to re-exec the script as another user via sudo (only if needed)
|
||||
exec_as() {
|
||||
|
@ -87,7 +87,7 @@ public_attach() {
|
|||
public_running() {
|
||||
cd || return
|
||||
echo "Running machines:"
|
||||
set -- $ls -t sockets "$@"
|
||||
set -- $ls -t sockets/monitors "$@"
|
||||
exec "$@"
|
||||
}
|
||||
|
||||
|
|
8
etc/runit/sv/virtiofsd/finish
Executable file
8
etc/runit/sv/virtiofsd/finish
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
# Read configuration
|
||||
sourceconf() { [ -r "$1" ] && . "$1"; }
|
||||
sourceconf ./conf
|
||||
|
||||
# Delete socket and PID file
|
||||
exec rm -f "$socket" "${socket}.pid"
|
|
@ -1,7 +1,13 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
# Read configuration
|
||||
sourceconf() {
|
||||
[ -r "$1" ] && . "$1"
|
||||
}
|
||||
sourceconf ./conf
|
||||
|
||||
# Start a virtiofsd sharing qemu shared dir
|
||||
exec /usr/lib/virtiofsd \
|
||||
--shared-dir ~qemu/shared \
|
||||
--socket-path /run/virtiofsd.sock \
|
||||
--shared-dir "$shared_dir" \
|
||||
--socket-path "$socket" \
|
||||
--socket-group qemu
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/sh -e
|
||||
#!/usr/bin/env sh
|
||||
set -e
|
||||
|
||||
# Invoked on termination if the last command failed
|
||||
error() { >&2 echo "$(basename "$0"): ${*}"; }
|
||||
|
@ -17,11 +18,10 @@ case "$1" in
|
|||
extension=qcow2
|
||||
;;
|
||||
socket)
|
||||
basedir=sockets
|
||||
basedir=sockets/monitors
|
||||
;;
|
||||
spice)
|
||||
basedir=spice
|
||||
extension=sock
|
||||
basedir=sockets/spice
|
||||
;;
|
||||
*)
|
||||
false
|
||||
|
@ -33,5 +33,7 @@ trap - EXIT
|
|||
|
||||
# Print the actual string
|
||||
basedir="${HOME}/${basedir}"
|
||||
name="$QEMUSH_NAME"
|
||||
[ -n "$2" ] && name="${name}-${2}"
|
||||
[ -n "$extension" ] && extension=".${extension}"
|
||||
printf %s/%s%s\\n "$basedir" "$QEMUSH_NAME" "$extension"
|
||||
printf %s/%s%s\\n "$basedir" "$name" "$extension"
|
||||
|
|
|
@ -26,7 +26,6 @@ command = [
|
|||
'-M', 'q35',
|
||||
'-cpu', 'host', '-smp', nproc,
|
||||
'-m', ram,
|
||||
'-net', 'nic'
|
||||
] + argv[1:]
|
||||
|
||||
# Print the final command and replace the main process with it
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
#!/bin/sh -x
|
||||
exec "$QEMUSH_BASE" \
|
||||
base=$(echo "$QEMUSH_BASE" | cut -d , -f 1)
|
||||
QEMUSH_BASE=$(echo "$QEMUSH_BASE" | cut -d , -f 2-)
|
||||
|
||||
exec "$base" \
|
||||
-vga qxl \
|
||||
-chardev spicevmc,id=vdagent,debug=0,name=vdagent \
|
||||
-device virtio-serial \
|
||||
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
|
||||
-spice port="$(first-free-port 5900)",addr=127.0.0.1,disable-ticketing=on \
|
||||
-spice port="$(first-free-port 5900)",addr=::1,disable-ticketing=on \
|
||||
-audiodev spice,id=snd0 \
|
||||
"$@"
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
#!/bin/sh -x
|
||||
|
||||
# Store VM name in environment variable
|
||||
export QEMUSH_NAME
|
||||
export QEMUSH_RAM=4G
|
||||
export QEMUSH_BASE=kvm
|
||||
[ -z "$QEMUSH_NAME" ] && QEMUSH_NAME=$(basename "$0")
|
||||
export QEMUSH_BASE=virtiofs,kvm
|
||||
[ -z "$QEMUSH_NAME" ] && {
|
||||
export QEMUSH_NAME
|
||||
QEMUSH_NAME=$(basename "$0")
|
||||
}
|
||||
|
||||
# Launch the virtual machine
|
||||
exec spice \
|
||||
-drive file="$(pathof disk)",if=virtio \
|
||||
-net user,hostname="${QEMUSH_NAME}" \
|
||||
-net nic -net user,hostname="${QEMUSH_NAME}" \
|
||||
-usbdevice tablet \
|
||||
-name "$QEMUSH_NAME" \
|
||||
-device intel-hda -device hda-duplex,audiodev=snd0 \
|
||||
"$@"
|
||||
|
|
Loading…
Reference in a new issue