Loading .github/workflows/review.yml +1 −1 Original line number Diff line number Diff line Loading @@ -63,5 +63,5 @@ jobs: with: level: warning reporter: github-pr-review shellcheck_flags: -x -e SC2001 -e SC2034 -e SC2064 -e SC2317 -e SC2153 shellcheck_flags: -x -e SC2001 -e SC2034 -e SC2064 -e SC2317 -e SC2153 -e SC1091 github_token: ${{ secrets.GITHUB_TOKEN }} src/boot.sh +5 −4 Original line number Diff line number Diff line Loading @@ -156,12 +156,13 @@ if [ -s "$PS" ] && [ -r "$PS" ]; then fi rm -f /var/run/tpm.pid TPM_PID="$QEMU_DIR/tpm.pid" rm -f "$TPM_PID" if [[ "$TPM" == [Yy1]* ]]; then { swtpm socket -t -d --tpmstate "backend-uri=file://$DEST.tpm" \ --ctrl type=unixio,path=/run/swtpm-sock --pid file=/var/run/tpm.pid --tpm2; rc=$?; } || : --ctrl type=unixio,path=/run/swtpm-sock --pid "file=$TPM_PID" --tpm2; rc=$?; } || : if (( rc != 0 )); then error "Failed to start TPM emulator, reason: $rc" Loading src/config.sh +2 −2 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ set -Eeuo pipefail : "${VMPORT:="off"}" : "${SERIAL:="mon:stdio"}" : "${USB:="qemu-xhci,id=xhci,p2=7,p3=7"}" : "${MONITOR:="telnet:localhost:$MON_PORT,server,nowait,nodelay"}" : "${MONITOR:="unix:$QEMU_DIR/qmp.sock,server,wait=off,nodelay"}" : "${SMP:="$CPU_CORES,sockets=1,dies=1,cores=$CPU_CORES,threads=1"}" msg="Configuring QEMU..." Loading @@ -31,7 +31,7 @@ if [[ "${MACHINE,,}" != "pc"* ]]; then if [[ "${BALLOONING:-}" != [Yy1]* ]]; then DEV_OPTS+=" -device virtio-balloon-pci,id=balloon0,bus=pcie.0" else MON_OPTS+=" -qmp unix:${QEMU_DIR}/qemu-qmp-ballooning.sock,server,nowait" MON_OPTS+=" -qmp unix:$QEMU_DIR/qemu-qmp-ballooning.sock,server,nowait" DEV_OPTS+=" -device virtio-balloon-pci,free-page-reporting=on,guest-stats-polling-interval=1,id=balloon0,bus=pcie.0" fi fi Loading src/entry.sh +17 −1 Original line number Diff line number Diff line Loading @@ -29,4 +29,20 @@ trap - ERR version=$(qemu-system-x86_64 --version | head -n 1 | cut -d '(' -f 1 | awk '{ print $NF }') info "Booting image${BOOT_DESC} using QEMU v$version..." exec qemu-system-x86_64 ${ARGS:+ $ARGS} [[ "$SHUTDOWN" != [Yy1]* ]] && exec qemu-system-x86_64 ${ARGS:+ $ARGS} if [ ! -t 1 ] || [ ! -c /dev/tty ]; then qemu-system-x86_64 ${ARGS:+ $ARGS} & else qemu-system-x86_64 ${ARGS:+ $ARGS} </dev/tty >/dev/tty & fi rc=0 wait $! || rc=$? sleep 1 & wait $! if [ "$rc" -ne 0 ]; then warn "QEMU exitcode was: $rc" fi [ ! -f "$QEMU_END" ] && finish 0 src/network.sh +7 −11 Original line number Diff line number Diff line Loading @@ -241,8 +241,6 @@ getHostPorts() { list+="$VNC_PORT," fi list+="$MON_PORT," if [[ "${WEB:-}" != [Nn]* ]]; then list+="$WEB_PORT," list+="$WSD_PORT," Loading Loading @@ -646,11 +644,8 @@ configureNAT() { closeBridge() { [ -s "$PASST_PID" ] && pKill "$(<"$PASST_PID")" rm -f "$PASST_PID" [ -s "$DNSMASQ_PID" ] && pKill "$(<"$DNSMASQ_PID")" rm -f "$DNSMASQ_PID" local pids=( "$PASST_PID" "$DNSMASQ_PID" ) mKill "${pids[@]}" ip link set "$VM_NET_TAP" down promisc off &> /dev/null || : ip link delete "$VM_NET_TAP" &> /dev/null || : Loading @@ -663,15 +658,15 @@ closeBridge() { } closeWeb() { local pid="" # Shutdown nginx nginx -s stop 2> /dev/null nginx -s stop 2>/dev/null || : fWait "nginx" # Shutdown websocket local pid="/var/run/websocketd.pid" [ -s "$pid" ] && pKill "$(<"$pid")" rm -f "$pid" [ -s "$WSD_PID" ] && pid="$(<"$WSD_PID")" [ -n "$pid" ] && pKill "$pid" && rm -f "$WSD_PID" return 0 } Loading @@ -688,6 +683,7 @@ closeNetwork() { exec 40<&- || true closeBridge return 0 } Loading Loading
.github/workflows/review.yml +1 −1 Original line number Diff line number Diff line Loading @@ -63,5 +63,5 @@ jobs: with: level: warning reporter: github-pr-review shellcheck_flags: -x -e SC2001 -e SC2034 -e SC2064 -e SC2317 -e SC2153 shellcheck_flags: -x -e SC2001 -e SC2034 -e SC2064 -e SC2317 -e SC2153 -e SC1091 github_token: ${{ secrets.GITHUB_TOKEN }}
src/boot.sh +5 −4 Original line number Diff line number Diff line Loading @@ -156,12 +156,13 @@ if [ -s "$PS" ] && [ -r "$PS" ]; then fi rm -f /var/run/tpm.pid TPM_PID="$QEMU_DIR/tpm.pid" rm -f "$TPM_PID" if [[ "$TPM" == [Yy1]* ]]; then { swtpm socket -t -d --tpmstate "backend-uri=file://$DEST.tpm" \ --ctrl type=unixio,path=/run/swtpm-sock --pid file=/var/run/tpm.pid --tpm2; rc=$?; } || : --ctrl type=unixio,path=/run/swtpm-sock --pid "file=$TPM_PID" --tpm2; rc=$?; } || : if (( rc != 0 )); then error "Failed to start TPM emulator, reason: $rc" Loading
src/config.sh +2 −2 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ set -Eeuo pipefail : "${VMPORT:="off"}" : "${SERIAL:="mon:stdio"}" : "${USB:="qemu-xhci,id=xhci,p2=7,p3=7"}" : "${MONITOR:="telnet:localhost:$MON_PORT,server,nowait,nodelay"}" : "${MONITOR:="unix:$QEMU_DIR/qmp.sock,server,wait=off,nodelay"}" : "${SMP:="$CPU_CORES,sockets=1,dies=1,cores=$CPU_CORES,threads=1"}" msg="Configuring QEMU..." Loading @@ -31,7 +31,7 @@ if [[ "${MACHINE,,}" != "pc"* ]]; then if [[ "${BALLOONING:-}" != [Yy1]* ]]; then DEV_OPTS+=" -device virtio-balloon-pci,id=balloon0,bus=pcie.0" else MON_OPTS+=" -qmp unix:${QEMU_DIR}/qemu-qmp-ballooning.sock,server,nowait" MON_OPTS+=" -qmp unix:$QEMU_DIR/qemu-qmp-ballooning.sock,server,nowait" DEV_OPTS+=" -device virtio-balloon-pci,free-page-reporting=on,guest-stats-polling-interval=1,id=balloon0,bus=pcie.0" fi fi Loading
src/entry.sh +17 −1 Original line number Diff line number Diff line Loading @@ -29,4 +29,20 @@ trap - ERR version=$(qemu-system-x86_64 --version | head -n 1 | cut -d '(' -f 1 | awk '{ print $NF }') info "Booting image${BOOT_DESC} using QEMU v$version..." exec qemu-system-x86_64 ${ARGS:+ $ARGS} [[ "$SHUTDOWN" != [Yy1]* ]] && exec qemu-system-x86_64 ${ARGS:+ $ARGS} if [ ! -t 1 ] || [ ! -c /dev/tty ]; then qemu-system-x86_64 ${ARGS:+ $ARGS} & else qemu-system-x86_64 ${ARGS:+ $ARGS} </dev/tty >/dev/tty & fi rc=0 wait $! || rc=$? sleep 1 & wait $! if [ "$rc" -ne 0 ]; then warn "QEMU exitcode was: $rc" fi [ ! -f "$QEMU_END" ] && finish 0
src/network.sh +7 −11 Original line number Diff line number Diff line Loading @@ -241,8 +241,6 @@ getHostPorts() { list+="$VNC_PORT," fi list+="$MON_PORT," if [[ "${WEB:-}" != [Nn]* ]]; then list+="$WEB_PORT," list+="$WSD_PORT," Loading Loading @@ -646,11 +644,8 @@ configureNAT() { closeBridge() { [ -s "$PASST_PID" ] && pKill "$(<"$PASST_PID")" rm -f "$PASST_PID" [ -s "$DNSMASQ_PID" ] && pKill "$(<"$DNSMASQ_PID")" rm -f "$DNSMASQ_PID" local pids=( "$PASST_PID" "$DNSMASQ_PID" ) mKill "${pids[@]}" ip link set "$VM_NET_TAP" down promisc off &> /dev/null || : ip link delete "$VM_NET_TAP" &> /dev/null || : Loading @@ -663,15 +658,15 @@ closeBridge() { } closeWeb() { local pid="" # Shutdown nginx nginx -s stop 2> /dev/null nginx -s stop 2>/dev/null || : fWait "nginx" # Shutdown websocket local pid="/var/run/websocketd.pid" [ -s "$pid" ] && pKill "$(<"$pid")" rm -f "$pid" [ -s "$WSD_PID" ] && pid="$(<"$WSD_PID")" [ -n "$pid" ] && pKill "$pid" && rm -f "$WSD_PID" return 0 } Loading @@ -688,6 +683,7 @@ closeNetwork() { exec 40<&- || true closeBridge return 0 } Loading