]> 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 9a8eb90769e8dc72a1286b87d9a3248313b8b1f4..66b70aa087442fa7e2ee48c5f112e964f77bcdb7 100755 (executable)
--- a/vinst
+++ b/vinst
@@ -35,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
@@ -70,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