]> 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 nameserver to be specified
[code/vinst.git] / vinst
diff --git a/vinst b/vinst
index 9a8eb90769e8dc72a1286b87d9a3248313b8b1f4..c6abe7299c743083329be4493c74f7bad0925a24 100755 (executable)
--- a/vinst
+++ b/vinst
@@ -35,6 +35,22 @@ while [ -n "$1" ]; do
       esac
       IPADDRESS="$1"
       ;;
+    (-d|--dns)
+      shift
+      if [ -z "$1" ]; then
+        echo >&2 'E: --dns/-d needs IP address'
+        exit 1
+      fi
+      NAMESERVER="$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
@@ -70,7 +86,7 @@ hostname=${HOSTNAME%%.*} \
 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