Skip to content

Commit ceea836

Browse files
95-efistub-kernel-bootcfg.install: fix loglevel, port upstream title changes
Closes: #26 Signed-off-by: Andrew Ammerlaan <[email protected]>
1 parent 0c43ca2 commit ceea836

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

hooks/systemd/95-efistub-kernel-bootcfg.install

+22-14
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ BOOT_DIR_ABS="${3}"
1313
KERNEL_IMAGE="${4}"
1414

1515
if [ "${KERNEL_INSTALL_VERBOSE}" -gt 0 ]; then
16-
LOGLEVEL="--loglevel info"
16+
LOGLEVEL="info"
1717
else
18-
LOGLEVEL="--loglevel error"
18+
LOGLEVEL="error"
1919
fi
2020

2121
if [[ ${KERNEL_INSTALL_LAYOUT} == "uki" ]]; then
@@ -27,21 +27,30 @@ if [[ ${KERNEL_INSTALL_LAYOUT} == "uki" ]]; then
2727
exit 1
2828
fi
2929

30+
unset PRETTY_NAME VERSION_ID
31+
if [[ -f /etc/os-release ]]; then
32+
# shellcheck source=/dev/null
33+
. /etc/os-release
34+
elif [[ -f /usr/lib/os-release ]]; then
35+
# shellcheck source=/dev/null
36+
. /usr/lib/os-release
37+
fi
38+
39+
TITLE="${PRETTY_NAME:+$PRETTY_NAME }${VERSION_ID:+$VERSION_ID }${KERNEL_VERSION} (UKI)"
3040
PARTLABEL="$(df "${UKI}" --output=source | tail -1 | xargs -r lsblk --output=PARTLABEL --noheadings)"
31-
if [[ -n "${PARTLABEL}" ]]; then
32-
TITLE="${KERNEL_VERSION} (UKI) on ${PARTLABEL}"
33-
else
34-
TITLE="${KERNEL_VERSION} (UKI)"
41+
if [[ -n ${PARTLABEL} ]]; then
42+
TITLE="${TITLE} on ${PARTLABEL}"
3543
fi
3644

3745
[[ "${KERNEL_INSTALL_VERBOSE}" -gt 0 ]] && echo "Adding ${UKI} to UEFI boot entries"
38-
kernel-bootcfg "${LOGLEVEL}" --add-uki "${UKI}" --title "${TITLE}" --once || exit 1
46+
kernel-bootcfg --loglevel "${LOGLEVEL}" --add-uki "${UKI}" --title "${TITLE}" --once || exit 1
3947
elif [[ ${COMMAND} == remove ]]; then
4048
[[ "${KERNEL_INSTALL_VERBOSE}" -gt 0 ]] && echo "Removing ${UKI} from UEFI boot entries"
41-
kernel-bootcfg "${LOGLEVEL}" --remove-uki "${UKI}" || exit 1
49+
kernel-bootcfg --loglevel "${LOGLEVEL}" --remove-uki "${UKI}" || exit 1
4250
fi
4351
elif [[ ${KERNEL_INSTALL_LAYOUT} == "efistub" ]]; then
4452

53+
unset PRETTY_NAME VERSION_ID
4554
if [[ -f /etc/os-release ]]; then
4655
# shellcheck source=/dev/null
4756
. /etc/os-release
@@ -63,7 +72,7 @@ elif [[ ${KERNEL_INSTALL_LAYOUT} == "efistub" ]]; then
6372
fi
6473

6574
KERNEL_BOOTCFG_ARGS=(
66-
"${LOGLEVEL}"
75+
--loglevel "${LOGLEVEL}"
6776
--once
6877
)
6978

@@ -91,11 +100,10 @@ elif [[ ${KERNEL_INSTALL_LAYOUT} == "efistub" ]]; then
91100
KERNEL_BOOTCFG_ARGS+=( --cmdline "${BOOT_OPTIONS}" )
92101
fi
93102

103+
TITLE="${PRETTY_NAME:+$PRETTY_NAME }${VERSION_ID:+$VERSION_ID }${KERNEL_VERSION} (plain)"
94104
PARTLABEL="$(df "${KERNEL_IMAGE}" --output=source | tail -1 | xargs -r lsblk --output=PARTLABEL --noheadings)"
95-
if [[ -n "${PARTLABEL}" ]]; then
96-
TITLE="${KERNEL_VERSION} (plain) on ${PARTLABEL}"
97-
else
98-
TITLE="${KERNEL_VERSION} (plain)"
105+
if [[ -n ${PARTLABEL} ]]; then
106+
TITLE="${TITLE} on ${PARTLABEL}"
99107
fi
100108

101109
KERNEL_BOOTCFG_ARGS+=(
@@ -107,7 +115,7 @@ elif [[ ${KERNEL_INSTALL_LAYOUT} == "efistub" ]]; then
107115
kernel-bootcfg "${KERNEL_BOOTCFG_ARGS[@]}" || exit 1
108116
elif [[ ${COMMAND} == remove ]]; then
109117
[[ "${KERNEL_INSTALL_VERBOSE}" -gt 0 ]] && echo "Removing ${KERNEL_IMAGE} from UEFI boot entries"
110-
kernel-bootcfg "${LOGLEVEL}" --remove-uki "${KERNEL_IMAGE}" || exit 1
118+
kernel-bootcfg --loglevel "${LOGLEVEL}" --remove-uki "${KERNEL_IMAGE}" || exit 1
111119
fi
112120
else
113121
exit 0

0 commit comments

Comments
 (0)