mirror of
https://git.proxmox.com/git/pve-kernel-meta
synced 2025-04-30 03:22:21 +00:00
proxmox-boot: add get_first_line_from_file helper and use it
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
parent
605438b0ac
commit
8de0567d10
@ -101,3 +101,11 @@ loop_esp_list() {
|
|||||||
"$@"
|
"$@"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_first_line() {
|
||||||
|
file="$1"
|
||||||
|
while IFS= read -r line || [ -n "$line" ]; do
|
||||||
|
break
|
||||||
|
done < "${file}"
|
||||||
|
echo "$line"
|
||||||
|
}
|
||||||
|
@ -46,9 +46,7 @@ update_esps() {
|
|||||||
fi
|
fi
|
||||||
if [ -f /etc/kernel/cmdline ]; then
|
if [ -f /etc/kernel/cmdline ]; then
|
||||||
# we can have cmdline files with multiple or no new line at all, handle both!
|
# we can have cmdline files with multiple or no new line at all, handle both!
|
||||||
while IFS= read -r CMDLINE || [ -n "$CMDLINE" ]; do
|
CMDLINE=$(get_first_line /etc/kernel/cmdline)
|
||||||
break
|
|
||||||
done < /etc/kernel/cmdline
|
|
||||||
echo ${CMDLINE} | grep -q 'root=' || \
|
echo ${CMDLINE} | grep -q 'root=' || \
|
||||||
{ warn "No root= parameter in /etc/kernel/cmdline found!"; exit 1; }
|
{ warn "No root= parameter in /etc/kernel/cmdline found!"; exit 1; }
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user