Skip to content

feat: Improved shutdown logic#1756

Closed
kroese wants to merge 57 commits into
masterfrom
dev
Closed

feat: Improved shutdown logic#1756
kroese wants to merge 57 commits into
masterfrom
dev

Conversation

@kroese

@kroese kroese commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings June 4, 2026 17:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread src/power.sh Outdated
Comment on lines +73 to +77
local i=0
local pid=""
local reason=$1
local pids=(
"/var/run/tpm.pid"
"/var/run/wsdd.pid"
"/var/run/samba/nmbd.pid"
"/var/run/samba/smbd.pid"
)
local pids=( "$SMB_PID" "$NMB_PID" "$DDN_PID" "$TPM_PID" "$WSD_PID" \
"$WEB_PID" "$PASST_PID" "$DNSMASQ_PID" "${BALLOONING_PID:-}" )
Comment thread src/power.sh
Comment on lines +207 to 212
[[ "$SHUTDOWN" != [Yy1]* ]] && return 0
[ -n "${QEMU_TIMEOUT:-}" ] && TIMEOUT="$QEMU_TIMEOUT"

_trap _graceful_shutdown SIGTERM SIGHUP SIGINT SIGABRT SIGQUIT
_trap graceful_shutdown SIGTERM SIGHUP SIGABRT SIGQUIT

return 0
Comment thread src/samba.sh Outdated
NMB_PID="/var/run/samba/nmbd.pid"
SMB_PID="/var/run/samba/smbd.pid"

rm -f "$SMB_PID" "$NMB_PID" "$DDN_PID"
Copilot AI review requested due to automatic review settings June 4, 2026 18:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread src/entry.sh Outdated
Comment on lines +35 to +48
coproc FILTER {
tee "$QEMU_PTY" |
sed -u \
-e 's/\x1B\[[=0-9;]*[a-z]//gi' \
-e 's/\x1B\x63//g' \
-e 's/\x1B\[[=?]7l//g' \
-e '/^$/d' \
-e 's/\x44\x53\x73//g' \
-e 's/failed to load Boot/skipped Boot/g' \
-e 's/0): Not Found/0)/g'
}

qemu-system-x86_64 ${ARGS:+ $ARGS} >&"${FILTER[1]}" &

Comment thread src/power.sh
Comment on lines +207 to 212
[[ "$SHUTDOWN" != [Yy1]* ]] && return 0
[ -n "${QEMU_TIMEOUT:-}" ] && TIMEOUT="$QEMU_TIMEOUT"

_trap _graceful_shutdown SIGTERM SIGHUP SIGINT SIGABRT SIGQUIT
_trap graceful_shutdown SIGTERM SIGHUP SIGABRT SIGQUIT

return 0
Comment thread src/power.sh
Comment on lines +92 to +93
error "Forcefully terminating $(app), reason: $display..."
{ disown "$pid" || :; kill -9 -- "$pid" || :; } 2>/dev/null
Copilot AI review requested due to automatic review settings June 4, 2026 19:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

Comment thread src/entry.sh Outdated
-e '/^$/d' \
-e 's/\x44\x53\x73//g' \
-e 's/failed to load Boot/skipped Boot/g' \
-e 's/0): Not Found/0)/g'
Comment thread src/entry.sh Outdated
Comment on lines +54 to +56
qemu-system-x86_64 ${ARGS:+ $ARGS} >&"${FILTER[1]}" &

pid=$!
Comment thread src/entry.sh Outdated
exit 1
fi

ls -l /proc/$FILTER_PID/fd
Comment thread src/power.sh
[ -n "${QEMU_TIMEOUT:-}" ] && TIMEOUT="$QEMU_TIMEOUT"

_trap _graceful_shutdown SIGTERM SIGHUP SIGINT SIGABRT SIGQUIT
_trap graceful_shutdown SIGTERM SIGHUP SIGABRT SIGQUIT
Comment thread src/power.sh
Comment on lines +73 to +74
local i=0
local pid=""
Copilot AI review requested due to automatic review settings June 4, 2026 19:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread src/power.sh
[ -n "${QEMU_TIMEOUT:-}" ] && TIMEOUT="$QEMU_TIMEOUT"

_trap _graceful_shutdown SIGTERM SIGHUP SIGINT SIGABRT SIGQUIT
_trap graceful_shutdown SIGTERM SIGHUP SIGABRT SIGQUIT
Comment thread src/power.sh Outdated
Comment on lines +73 to +77
local i=0
local pid=""
local reason=$1
local pids=(
"/var/run/tpm.pid"
"/var/run/wsdd.pid"
"/var/run/samba/nmbd.pid"
"/var/run/samba/smbd.pid"
)
local pids=( "$SMB_PID" "$NMB_PID" "$DDN_PID" "$TPM_PID" "$WSD_PID" \
"$WEB_PID" "$PASST_PID" "$DNSMASQ_PID" "${BALLOONING_PID:-}" )
Copilot AI review requested due to automatic review settings June 4, 2026 20:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/power.sh
Comment on lines +207 to 212
[[ "$SHUTDOWN" != [Yy1]* ]] && return 0
[ -n "${QEMU_TIMEOUT:-}" ] && TIMEOUT="$QEMU_TIMEOUT"

_trap _graceful_shutdown SIGTERM SIGHUP SIGINT SIGABRT SIGQUIT
_trap graceful_shutdown SIGTERM SIGHUP SIGABRT SIGQUIT

return 0
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 4, 2026 20:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@kroese kroese closed this Jun 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread src/power.sh
Comment on lines +76 to +77
local pids=( "${SMB_PID:-}" "${NMB_PID:-}" "${DDN_PID:-}" "${TPM_PID:-}" "${WSD_PID:-}" \
"${WEB_PID:-}" "${PASST_PID:-}" "${DNSMASQ_PID:-}" "${BALLOONING_PID:-}" )
Comment thread src/power.sh
[ -n "${QEMU_TIMEOUT:-}" ] && TIMEOUT="$QEMU_TIMEOUT"

_trap _graceful_shutdown SIGTERM SIGHUP SIGINT SIGABRT SIGQUIT
_trap graceful_shutdown SIGTERM SIGHUP SIGABRT SIGQUIT
Comment thread src/entry.sh
Comment on lines +53 to +60
"${cmd[@]}" ${ARGS:+ $ARGS} >"$pipe" &

pid=$!
( sleep 30; boot ) &
tail -fn +0 "$QEMU_LOG" --pid=$$ 2>/dev/null &
cat "$QEMU_TERM" 2> /dev/null | tee "$QEMU_PTY" | \
sed -u -e 's/\x1B\[[=0-9;]*[a-z]//gi' \
-e 's/\x1B\x63//g' -e 's/\x1B\[[=?]7l//g' \
-e '/^$/d' -e 's/\x44\x53\x73//g' \
-e 's/failed to load Boot/skipped Boot/g' \
-e 's/0): Not Found/0)/g' & wait $! || :

rc=0
wait "$pid" || rc=$?
[ -f "$QEMU_END" ] && exit "$rc"
@kroese kroese deleted the dev branch June 4, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants