if we fallback to /proc/cmdline, it can include the booted initrd.

to avoid loader entries with initrd 'options' lines, we have to parse
them out.

Signed-off-by: Oguz Bektas <o.bek...@proxmox.com>
---

v2->v3:
* match forward slashes
* match underscore
* match zero or more whitespace at the end

 efiboot/zz-pve-efiboot | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/efiboot/zz-pve-efiboot b/efiboot/zz-pve-efiboot
index 4756555..8771da9 100755
--- a/efiboot/zz-pve-efiboot
+++ b/efiboot/zz-pve-efiboot
@@ -50,7 +50,8 @@ update_esps() {
                CMDLINE="$(cat /etc/kernel/cmdline)"
        else
                warn "No /etc/kernel/cmdline found - falling back to 
/proc/cmdline"
-               CMDLINE="$(cat /proc/cmdline)"
+               # remove initrd entries
+               CMDLINE="$(awk '{gsub(/\yinitrd=([0-9a-zA-Z\/\\._-])*\s*/,x)}1' 
/proc/cmdline)"
        fi
 
        loop_esp_list update_esp_func
-- 
2.20.1

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

Reply via email to