Message ID | 20250619082919.12390-1-jimmy.ho@sifive.com |
---|---|
State | New |
Headers | show |
Series | nfsrootfs: disable warning message if bootargs root parameter have not been defined | expand |
On Thu Jun 19, 2025 at 10:29 AM CEST, Jimmy Ho via lists.openembedded.org wrote: > we have case that don't define root in bootargs, > if [ ${bootparam_root} != "/dev/nfs" ] will output warning "/init.d/85-nfsrootfs: line 4: [: !=: unary operator expected" > by checking whether bootparam_root is defined can clear this warning message > > Signed-off-by: Jimmy Ho <jimmy.ho@sifive.com> > --- > meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs > index e67ee4c25d..1e76258ce1 100644 > --- a/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs > +++ b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs > @@ -1,7 +1,7 @@ > #!/bin/sh > > nfsrootfs_enabled() { > - if [ ${bootparam_root} != "/dev/nfs" ] || [ -z ${bootparam_nfsroot} ]; then > + if [ -z ${bootparam_root} ] || [ ${bootparam_root} != "/dev/nfs" ] || [ -z ${bootparam_nfsroot} ]; then I think a better way of fixing this would be to replace [ ${bootparam_root} != "/dev/nfs" ] by [ "${bootparam_root}" != "/dev/nfs" ] instead of an extra condition. Antonin
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs index e67ee4c25d..1e76258ce1 100644 --- a/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs +++ b/meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs @@ -1,7 +1,7 @@ #!/bin/sh nfsrootfs_enabled() { - if [ ${bootparam_root} != "/dev/nfs" ] || [ -z ${bootparam_nfsroot} ]; then + if [ -z ${bootparam_root} ] || [ ${bootparam_root} != "/dev/nfs" ] || [ -z ${bootparam_nfsroot} ]; then return 1 fi return 0
we have case that don't define root in bootargs, if [ ${bootparam_root} != "/dev/nfs" ] will output warning "/init.d/85-nfsrootfs: line 4: [: !=: unary operator expected" by checking whether bootparam_root is defined can clear this warning message Signed-off-by: Jimmy Ho <jimmy.ho@sifive.com> --- meta/recipes-core/initrdscripts/initramfs-framework/nfsrootfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)