[pve-devel] [PATCH v3 kernel-meta] fix #2403: exclude initrd entries from /proc/cmdline
Oguz Bektas
o.bektas at proxmox.com
Fri Nov 8 13:20:11 CET 2019
On Thu, Nov 07, 2019 at 08:43:17PM +0100, Thomas Lamprecht wrote:
> On 10/16/19 1:17 PM, Oguz Bektas wrote:
> > 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.bektas at 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)"
>
> sooo, this does not works at all with the default installed mawk...
> Only with gnu awk, which one may get fast installed on a developer
> workstation... :/ So we all did not test clean environments..
:/
>
> it seems mawk has no word boundary regexp[0], soo either we depend on gawk
> or we find a way were it works with mawk..
>
> [0]: https://mail-index.netbsd.org/tech-userlevel/2012/12/02/msg006954.html
i looked around a bit but couldn't figure out a way to make it work with
mawk. so maybe it's better to just use perl instead, to avoid having
gawk dependency?
perl -ne 's/\binitrd=([0-9a-zA-Z\\\/.-])*\s*//g; print;' /proc/cmdline
>
> > fi
> >
> > loop_esp_list update_esp_func
> >
>
More information about the pve-devel
mailing list