]> git.madduck.net Git - code/vinst.git/blobdiff - vinst

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Allow gateway to be specified, or calculate it with ipcalc
[code/vinst.git] / vinst
diff --git a/vinst b/vinst
index 5ebd3cae3cc9e808f7de88f1f02c5a54c764da8c..66b70aa087442fa7e2ee48c5f112e964f77bcdb7 100755 (executable)
--- a/vinst
+++ b/vinst
@@ -5,6 +5,7 @@ set -e
 # defaults
 RAM=512
 DISK=20
 # defaults
 RAM=512
 DISK=20
+STORAGE_POOL=default
 QEMU_URI=qemu:///system
 SUITE=wheezy
 CONSOLE='console=tty0 console=ttyS0,115200n8'
 QEMU_URI=qemu:///system
 SUITE=wheezy
 CONSOLE='console=tty0 console=ttyS0,115200n8'
@@ -34,6 +35,14 @@ while [ -n "$1" ]; do
       esac
       IPADDRESS="$1"
       ;;
       esac
       IPADDRESS="$1"
       ;;
+    (-g|--gateway)
+      shift
+      if [ -z "$1" ]; then
+        echo >&2 'E: --gateway/-g needs IP address'
+        exit 1
+      fi
+      GATEWAY="$1"
+      ;;
     (-r|--ram)
       shift
       if [ -z "$1" ]; then
     (-r|--ram)
       shift
       if [ -z "$1" ]; then
@@ -69,7 +78,7 @@ hostname=${HOSTNAME%%.*} \
 domain=${HOSTNAME#*.}"
 
 if [ -n "$IPADDRESS" ]; then
 domain=${HOSTNAME#*.}"
 
 if [ -n "$IPADDRESS" ]; then
-  if [ -z "$GATEWAY" ]; then
+  if [ -z "$GATEWAY" ] && [ -x $(command -v ipcalc) ]; then
     # default to the first IP in the network
     GATEWAY=$(ipcalc $IPADDRESS | grep HostMin | awk '{print $2}')
   fi
     # default to the first IP in the network
     GATEWAY=$(ipcalc $IPADDRESS | grep HostMin | awk '{print $2}')
   fi