2019-02-20 22:10:38 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
# Create ReactOS disk
|
2019-02-21 23:09:21 +00:00
|
|
|
if [ ! -f /var/lib/qemu/images/reactos.img ]; then
|
2021-10-31 12:07:59 +00:00
|
|
|
qemu-img create -f qcow2 /var/lib/qemu/images/reactos.img "${VM_DISK_SIZE:?}"
|
2019-02-21 23:09:21 +00:00
|
|
|
fi
|
2019-02-20 22:10:38 +00:00
|
|
|
|
2021-11-02 18:23:18 +00:00
|
|
|
stop() {
|
|
|
|
for s in "${SVDIR:?}"/*; do sv force-stop "${s:?}" >/dev/null 2>&1; done
|
|
|
|
kill -HUP "${RUNSVDIRPID:?}"; wait "${RUNSVDIRPID:?}"
|
|
|
|
}
|
|
|
|
trap stop EXIT TERM INT HUP
|
|
|
|
|
|
|
|
if [ "$#" -gt 0 ] || [ -t 0 ] || [ -t 1 ]; then
|
|
|
|
runsvdir -P "${SVDIR:?}" >/dev/null 2>&1 & RUNSVDIRPID=$!
|
|
|
|
"$@"
|
|
|
|
else
|
|
|
|
runsvdir -P "${SVDIR:?}" & RUNSVDIRPID=$!
|
|
|
|
wait "${RUNSVDIRPID:?}"
|
|
|
|
fi
|