Unverified Commit bdc15ac2 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

feat: Implemented graceful shutdown (#421)

parent 86e3f100
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ RUN apk --update --no-cache add unzip && \
    rm -rf /tmp/* /var/tmp/* /var/cache/apk/*

FROM scratch AS runner
COPY --from=qemux/qemu:7.31 / /
COPY --from=qemux/qemu:7.32 / /

ARG VERSION_ARG="0.0"
ARG VERSION_KVM_OPENCORE="v21"
+14 −1
Original line number Diff line number Diff line
@@ -30,4 +30,17 @@ trap - ERR
version=$(qemu-system-x86_64 --version | head -n 1 | cut -d '(' -f 1 | awk '{ print $NF }')
info "Booting ${APP}${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"