#! /bin/sh

usage() {
  echo 'nbdstart [ -f conffile ] { module | server | client } { id | -a }'
}

while [ $# -gt 0 ]; do
  case "$1" in 
   -a) which="-a" ;;
   -f) shift; NBD_CONFIG="$1";;
   -*) opts="$opts $i" ;;
   *) [ -z "$what" ] && what="$1"  && continue
      [ -z "$which" ] && which="$1"  && continue
      usage ; exit 1
      ;;
  esac
  shift
done

if [ "$which" = "-a" ]; then
  which=
fi
if [ "$what" = "all" ]; then
  if [ -n "$which"  ]; then
    usage
    exit 1
  fi
  what=
fi

export NBD_CONFIG
nbd start $what $which

