Name based connects fail because of the quotes around the $nbdport.
For name based connects, the -N option also gets included. For
instance nbd-client 192.168.0.1 '-N ltsp' /dev/nbd0.
I believe the quotes are not necessary for actual port numbers.
i=$(( $i + 1))
done
-nbd-client $preopts "$nbdserver" "$nbdport" /dev/nbd0 $opts || exit 1
+nbd-client $preopts "$nbdserver" $nbdport /dev/nbd0 $opts || exit 1
# If we didn't get a root= on the command line, then we need to
# add the udev rules for mounting the nbd0 device