From 25ef69650687f0fca9951bdcb16b2b3679a0601d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 9 Sep 2020 15:04:52 +0200 Subject: Updates to private install infrastructure and instructions --- etc/private/vm-start-base | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'etc/private/vm-start-base') diff --git a/etc/private/vm-start-base b/etc/private/vm-start-base index a88ea2d..4a81661 100755 --- a/etc/private/vm-start-base +++ b/etc/private/vm-start-base @@ -15,6 +15,9 @@ # --mac # MAC address to use for the machine. # +# --pid +# PID file path, /tmp/vm-.pid if unspecified. +# # --monitor # Monitor UNIX socket path, /tmp/vm--mon.sock if unspecified. # @@ -22,15 +25,16 @@ # Console UNIX socket path, /tmp/vm--con.sock if unspecified. # # --stdio -# Connect both console and monitor to stdio (multiplexed). +# Connect both console and monitor to stdio (multiplexed). This disables +# the creation of the monitor and console sockets. # # --stdio-monior -# Connect only monitor to stdio. +# Connect only monitor to stdio. This disables the creation of the monitor +# socket. # usage="usage: $0 [] []" -owd="$(pwd)" -trap "{ cd '$owd'; exit 1; }" ERR +trap "{ exit 1; }" ERR set -o errtrace # Trap in functions. function info () { echo "$*" 1>&2; } @@ -46,6 +50,7 @@ cpu=1 ram=2G tap= mac="de:ad:be:ef:b8:da" +pid= mon= con= stdio= @@ -73,6 +78,11 @@ while [ "$#" -gt 0 ]; do mac="$1" shift ;; + --pid) + shift + pid="$1" + shift + ;; --monitor) shift mon="$1" @@ -133,6 +143,11 @@ if [ -z "$tap" ]; then del_tap=true fi +if [ -z "$pid" ]; then + pid="/tmp/vm-$tap.pid" +fi +echo "$$" >"$pid" + if [ -z "$mon" ]; then mon="/tmp/vm-$tap-mon.sock" fi @@ -182,6 +197,10 @@ fi "${qemu[@]}" "${ops[@]}" -boot c "$@" +if [ "$pid" -o "$mon" -o "$con" ]; then + rm -f "$pid" "$mon" "$con" +fi + if [ "$del_tap" ]; then sudo ip tuntap delete "$tap" mode tap fi -- cgit v1.1