X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=sbin%2Fgrml-router;h=cd1e19d666d15ab3253ab483543b0c4103f51187;hb=af7e79258099000fb08013a77e1e83680ca4a59f;hp=b959f12f4f73f3180c95102fafe4bdb5b14ee09a;hpb=bc56d430ed4f7eb77355cd3db871d7a7078d051b;p=grml-network.git diff --git a/sbin/grml-router b/sbin/grml-router index b959f12..cd1e19d 100755 --- a/sbin/grml-router +++ b/sbin/grml-router @@ -1,7 +1,7 @@ #!/bin/sh # Filename: grml-router # Purpose: set up your box as NAT-router -# Authors: grml-team (grml.org), Ulrich Dangel , Michael Prokop +# Authors: grml-team (grml.org), Ulrich Dangel , Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. ################################################################################ @@ -13,32 +13,27 @@ CONFIG_FILE=/etc/grml/routersetup check4root || exit 1 -if ! [ -r $CONFIG_FILE ] ; then - eerror "$CONFIG_FILE could not be read." - exit 1 +if [ -r "$CONFIG_FILE" ] ; then + . "$CONFIG_FILE" +else + ewarn "Could not read $CONFIG_FILE" fi -. $CONFIG_FILE - -if [ -z "$OUTDEV" ] ; then - eewarn "Outgoing device is not set in $CONFIG_FILE" - eewarn "Setting Outgoing device to auto" - OUTDEV=auto -fi +# defaults if unconfigured +[ -n "$OUTDEV" ] || OUTDEV=auto +[ -n "$IPTABLES" ] || IPTABLES=/sbin/iptables case "$OUTDEV" in - auto|default) + auto|default) OUTDEV=$(defaultGWDev) if [ -z "$OUTDEV" ] ; then - eerror "The outgoing device could not be determined." - eerror "Please adjust OUTDEV in $CONFIG_FILE" - exit 1 + eerror "The outgoing device could not be determined." + eerror "Please adjust OUTDEV in $CONFIG_FILE or set OUTDEV as environment variable" + exit 1 fi ;; esac -[ -n "$IPTABLES" ] || IPTABLES=/sbin/iptables - check4progs $IPTABLES || exit 1 case "$1" in