mirror of
https://git.proxmox.com/git/pve-kernel-meta
synced 2025-04-28 16:36:48 +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
|
||||
}
|
||||
|
||||
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
|
||||
if [ -f /etc/kernel/cmdline ]; then
|
||||
# we can have cmdline files with multiple or no new line at all, handle both!
|
||||
while IFS= read -r CMDLINE || [ -n "$CMDLINE" ]; do
|
||||
break
|
||||
done < /etc/kernel/cmdline
|
||||
CMDLINE=$(get_first_line /etc/kernel/cmdline)
|
||||
echo ${CMDLINE} | grep -q 'root=' || \
|
||||
{ warn "No root= parameter in /etc/kernel/cmdline found!"; exit 1; }
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user