[pve-devel] [PATCH kernel-meta] use perl instead of (g)awk to clean /proc/cmdline

Oguz Bektas o.bektas at proxmox.com
Fri Nov 8 13:47:22 CET 2019


this awk line only works with gawk because of implementation differences
between awk alternatives.
debian has mawk installed by default, and mawk does not implement word
boundary regex. to avoid having to depend on gawk, we can just use perl
instead.

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 efiboot/zz-pve-efiboot | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/efiboot/zz-pve-efiboot b/efiboot/zz-pve-efiboot
index 1985d65..afdd665 100755
--- a/efiboot/zz-pve-efiboot
+++ b/efiboot/zz-pve-efiboot
@@ -51,7 +51,7 @@ update_esps() {
 	else
 		warn "No /etc/kernel/cmdline found - falling back to /proc/cmdline"
 		# remove initrd entries
-		CMDLINE="$(awk '{ gsub(/\yinitrd=([0-9a-zA-Z\/\\._-])*\s*/, ""); print $0 }' /proc/cmdline)"
+		CMDLINE="$(perl -pe 's/\binitrd=([0-9a-zA-Z\\\/.-])*\s*//g;' /proc/cmdline)"
 	fi
 
 	loop_esp_list update_esp_func
-- 
2.20.1




More information about the pve-devel mailing list