make nbd port check more robust
authorWim Muskee <wimmuskee@gmail.com>
Sat, 9 Feb 2013 11:54:20 +0000 (12:54 +0100)
committerHarald Hoyer <harald@redhat.com>
Mon, 11 Feb 2013 14:44:11 +0000 (15:44 +0100)
The following change makes the check for the nbd port or named export
more robust.
I wasn't sure whether to include sed in the dracut_install() of
module-setup.sh since net already does that (and nbd depends on that).

modules.d/95nbd/nbdroot.sh

index 4d06425..b176a16 100755 (executable)
@@ -31,7 +31,7 @@ nbdflags=${root%%:*}
 nbdopts=${root#*:}
 
 # If nbdport not an integer, then assume name based import
-if [ "${nbdport%[0-9]}" = "$nbdport" ]; then
+if [ ! -z $(echo "$nbdport" | sed 's/[0-9]//g') ]; then
     nbdport="-N $nbdport"
 fi