limine-snapper.sh: validate parsed CMDLINE in pre-populated branch
The harvest branch already enforces non-empty cmdline + presence of root=. The pre-populated branch (added in 0d2688a5) was missing the same validation, so a malformed /etc/default/limine could slip through and the later cryptdevice= check would silently no-op because $CMDLINE was empty.
This commit is contained in:
@@ -17,6 +17,15 @@ EOF
|
|||||||
if [[ -f /etc/default/limine ]] && ! grep -q "@@CMDLINE@@" /etc/default/limine; then
|
if [[ -f /etc/default/limine ]] && ! grep -q "@@CMDLINE@@" /etc/default/limine; then
|
||||||
CMDLINE=$(grep '^KERNEL_CMDLINE\[default\]+=' /etc/default/limine | head -1 |
|
CMDLINE=$(grep '^KERNEL_CMDLINE\[default\]+=' /etc/default/limine | head -1 |
|
||||||
sed 's|^KERNEL_CMDLINE\[default\]+="||; s|"$||')
|
sed 's|^KERNEL_CMDLINE\[default\]+="||; s|"$||')
|
||||||
|
|
||||||
|
if [[ -z ${CMDLINE// } ]]; then
|
||||||
|
echo "Error: /etc/default/limine has no KERNEL_CMDLINE[default]+= line" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ $CMDLINE != *root=* ]]; then
|
||||||
|
echo "Error: cmdline parsed from /etc/default/limine has no root=: $CMDLINE" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# Find config location written by archinstall (legacy harvest path)
|
# Find config location written by archinstall (legacy harvest path)
|
||||||
if [[ -f /boot/EFI/arch-limine/limine.conf ]]; then
|
if [[ -f /boot/EFI/arch-limine/limine.conf ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user