Signed-off-by: Stoiko Ivanov <s.iva...@proxmox.com>
---
 proxmox-boot/functions       | 8 ++++++++
 proxmox-boot/zz-proxmox-boot | 4 +---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/proxmox-boot/functions b/proxmox-boot/functions
index 6e19c20..4515a2d 100755
--- a/proxmox-boot/functions
+++ b/proxmox-boot/functions
@@ -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"
+}
diff --git a/proxmox-boot/zz-proxmox-boot b/proxmox-boot/zz-proxmox-boot
index 90d4aa9..db73166 100755
--- a/proxmox-boot/zz-proxmox-boot
+++ b/proxmox-boot/zz-proxmox-boot
@@ -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
-- 
2.30.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to