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))
|
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
|
QEMUSH_DIRS_NAMES := bin launchers disks sockets/monitors sockets/spice
|
||||||
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)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
# version=0.4.1
|
# version=0.5.0
|
||||||
|
|
||||||
# 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 "$@"
|
set -- $ls -t sockets/monitors "$@"
|
||||||
exec "$@"
|
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
|
#!/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 ~qemu/shared \
|
--shared-dir "$shared_dir" \
|
||||||
--socket-path /run/virtiofsd.sock \
|
--socket-path "$socket" \
|
||||||
--socket-group qemu
|
--socket-group qemu
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/sh -e
|
#!/usr/bin/env sh
|
||||||
|
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"): ${*}"; }
|
||||||
|
@ -17,11 +18,10 @@ case "$1" in
|
||||||
extension=qcow2
|
extension=qcow2
|
||||||
;;
|
;;
|
||||||
socket)
|
socket)
|
||||||
basedir=sockets
|
basedir=sockets/monitors
|
||||||
;;
|
;;
|
||||||
spice)
|
spice)
|
||||||
basedir=spice
|
basedir=sockets/spice
|
||||||
extension=sock
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
false
|
false
|
||||||
|
@ -33,5 +33,7 @@ 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" "$QEMUSH_NAME" "$extension"
|
printf %s/%s%s\\n "$basedir" "$name" "$extension"
|
||||||
|
|
|
@ -26,7 +26,6 @@ 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
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
#!/bin/sh -x
|
#!/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 \
|
-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=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
|
#!/bin/sh -x
|
||||||
|
|
||||||
# Store VM name in environment variable
|
|
||||||
export QEMUSH_NAME
|
|
||||||
export QEMUSH_RAM=4G
|
export QEMUSH_RAM=4G
|
||||||
export QEMUSH_BASE=kvm
|
export QEMUSH_BASE=virtiofs,kvm
|
||||||
[ -z "$QEMUSH_NAME" ] && QEMUSH_NAME=$(basename "$0")
|
[ -z "$QEMUSH_NAME" ] && {
|
||||||
|
export 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 user,hostname="${QEMUSH_NAME}" \
|
-net nic -net user,hostname="${QEMUSH_NAME}" \
|
||||||
-usbdevice tablet \
|
-usbdevice tablet \
|
||||||
-name "$QEMUSH_NAME" \
|
-name "$QEMUSH_NAME" \
|
||||||
|
-device intel-hda -device hda-duplex,audiodev=snd0 \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
Loading…
Reference in a new issue