DISTRO=$DEFAULT_DISTRO
function usage () {
message="$@"
- echo "usage : $COMMAND [-i] [-f distro] hostname"
+ echo "usage : $COMMAND [-i] [-f distro] [-I Image] hostname"
echo " default distro is $DEFAULT_DISTRO"
[ -n "$message" ] && echo $message
exit 1
}
-while getopts "f:ih" flag; do
+while getopts "f:I:ih" flag; do
case $flag in
f) DISTRO=$OPTARG;;
i) INTERACTIVE=true ;;
+ I) IMAGE=$OPTARG;;
?|h) usage "" ;;
esac
done
fqdn=$container.$DOMAIN
-command="$BUILD/lbuild-initvm.sh -f $DISTRO -n $fqdn $container"
+if [ -n "$IMAGE" ]; then
+ command="$BUILD/lbuild-initvm.sh -f $DISTRO -n $fqdn -i $IMAGE $container"
+else
+ command="$BUILD/lbuild-initvm.sh -f $DISTRO -n $fqdn $container"
+fi
if [ -n "$INTERACTIVE" ] ; then
echo -n "Run $command OK ? "