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="/var/run/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 +1 −1 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/monitor.sock,server,wait=off,nodelay"}" : "${SMP:="$CPU_CORES,sockets=1,dies=1,cores=$CPU_CORES,threads=1"}" msg="Configuring QEMU..." Loading src/entry.sh +14 −1 Original line number Diff line number Diff line Loading @@ -29,4 +29,17 @@ 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=$? [ -f "$QEMU_END" ] && exit "$rc" sleep 1 & wait $! finish "$rc" src/network.sh +5 −15 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 @@ -664,14 +659,8 @@ closeBridge() { closeWeb() { # Shutdown nginx nginx -s stop 2> /dev/null fWait "nginx" # Shutdown websocket local pid="/var/run/websocketd.pid" [ -s "$pid" ] && pKill "$(<"$pid")" rm -f "$pid" local pids=( "$WEB_PID" "$WSD_PID" ) mKill "${pids[@]}" return 0 } Loading @@ -688,6 +677,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="/var/run/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 +1 −1 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/monitor.sock,server,wait=off,nodelay"}" : "${SMP:="$CPU_CORES,sockets=1,dies=1,cores=$CPU_CORES,threads=1"}" msg="Configuring QEMU..." Loading
src/entry.sh +14 −1 Original line number Diff line number Diff line Loading @@ -29,4 +29,17 @@ 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=$? [ -f "$QEMU_END" ] && exit "$rc" sleep 1 & wait $! finish "$rc"
src/network.sh +5 −15 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 @@ -664,14 +659,8 @@ closeBridge() { closeWeb() { # Shutdown nginx nginx -s stop 2> /dev/null fWait "nginx" # Shutdown websocket local pid="/var/run/websocketd.pid" [ -s "$pid" ] && pKill "$(<"$pid")" rm -f "$pid" local pids=( "$WEB_PID" "$WSD_PID" ) mKill "${pids[@]}" return 0 } Loading @@ -688,6 +677,7 @@ closeNetwork() { exec 40<&- || true closeBridge return 0 } Loading