Skip to content

Commit ad127f3

Browse files
committed
recovery shell: stop double printing errors on first launch
1 parent 4868300 commit ad127f3

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

zfsbootmenu/lib/kmsg-log-lib.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ print_kmsg_logs() {
104104
# dmesg from dmesg-util can helpfully do --since, but only if it's also allowed to print the time out
105105
# so always print the time, optionally set --since, and filter the timestamp after
106106
if output="$( dmesg -f user --color=never -l "${levels}" ${since:+--since ${since}} 2>/dev/null )" ; then
107+
# shellcheck disable=SC2001
107108
echo "${output}" | sed 's/^\[.*\]\ //'
108109
else
109110
# Both util-linux and Busybox dmesg support the -r flag. However, the log level that is

zfsbootmenu/lib/zfsbootmenu-core.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1943,7 +1943,8 @@ emergency_shell() {
19431943

19441944
if [ -f "${BASE}/have_errors" ]; then
19451945
print_kmsg_logs "err"
1946-
echo ""
1946+
echo
1947+
rm "${BASE}/have_errors"
19471948
fi
19481949

19491950
command -v efibootmgr >/dev/null 2>&1 && mount_efivarfs "rw"

zfsbootmenu/libexec/recovery-error-printer

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
PROMPT_TS_FILE="${BASE}/.errors_since"
3+
PROMPT_TS_FILE="${BASE}/errors_since"
44

55
[ -f "${PROMPT_TS_FILE}" ] && read -r prompt_ts < "${PROMPT_TS_FILE}"
66

@@ -11,7 +11,7 @@ if [ -f "${BASE}/have_errors" ]; then
1111
echo
1212
print_kmsg_logs "err" ${prompt_ts:+${prompt_ts}}
1313
echo
14-
rm "/zfsbootmenu/have_errors"
14+
rm "${BASE}/have_errors"
1515
fi
1616

1717
printf '%(%Y-%m-%dT%H:%M:%S)T' > "${PROMPT_TS_FILE}"

0 commit comments

Comments
 (0)