2010-10-21 23:50:12 +01:00
|
|
|
#! @shell@ -e
|
|
|
|
|
|
|
|
# Shows the usage of this command to the user
|
|
|
|
|
|
|
|
showUsage()
|
|
|
|
{
|
2010-12-06 22:02:37 +00:00
|
|
|
echo "Usage: $0 network_expr"
|
2010-10-21 23:50:12 +01:00
|
|
|
echo "Options:"
|
|
|
|
echo
|
2010-12-06 22:02:37 +00:00
|
|
|
echo "--no-out-link Do not create a 'result' symlink"
|
|
|
|
echo "--show-trace Shows the output trace"
|
|
|
|
echo "-h,--help Shows the usage of this command"
|
2010-10-21 23:50:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Parse valid argument options
|
|
|
|
|
2011-01-17 16:15:59 +00:00
|
|
|
PARAMS=`getopt -n $0 -o h -l no-out-link,show-trace,help -- "$@"`
|
2010-10-21 23:50:12 +01:00
|
|
|
|
|
|
|
if [ $? != 0 ]
|
|
|
|
then
|
|
|
|
showUsage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
eval set -- "$PARAMS"
|
|
|
|
|
|
|
|
# Evaluate valid options
|
|
|
|
|
|
|
|
while [ "$1" != "--" ]
|
|
|
|
do
|
|
|
|
case "$1" in
|
2010-12-06 22:02:37 +00:00
|
|
|
--no-out-link)
|
|
|
|
noOutLinkArg="--no-out-link"
|
|
|
|
;;
|
2010-10-21 23:50:12 +01:00
|
|
|
--show-trace)
|
|
|
|
showTraceArg="--show-trace"
|
|
|
|
;;
|
|
|
|
-h|--help)
|
|
|
|
showUsage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2010-12-06 22:02:37 +00:00
|
|
|
shift
|
|
|
|
|
2010-10-21 23:50:12 +01:00
|
|
|
# Validate the given options
|
|
|
|
|
2013-07-03 10:13:58 +01:00
|
|
|
if [ "$1" = "" ]
|
2010-10-21 23:50:12 +01:00
|
|
|
then
|
2010-12-06 22:02:37 +00:00
|
|
|
echo "ERROR: A network expression must be specified!" >&2
|
|
|
|
exit 1
|
|
|
|
else
|
2013-07-03 10:13:58 +01:00
|
|
|
networkExpr=$(readlink -f $1)
|
2010-10-21 23:50:12 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Build a network of VMs
|
|
|
|
|
2012-05-03 13:31:01 +01:00
|
|
|
nix-build '<nixos/modules/installer/tools/nixos-build-vms/build-vms.nix>' \
|
2013-07-03 10:13:58 +01:00
|
|
|
--argstr networkExpr $networkExpr $noOutLinkArg $showTraceArg
|