X-Git-Url: http://git.grml.org/?p=grml-network.git;a=blobdiff_plain;f=sbin%2Fgrml-router;h=cd1e19d666d15ab3253ab483543b0c4103f51187;hp=ec3716854dc754164b15fb3a16fcc2e97f86a58a;hb=af7e79258099000fb08013a77e1e83680ca4a59f;hpb=4dd28e782446cb5101be9cb1ce5eb3d4df4003e3 diff --git a/sbin/grml-router b/sbin/grml-router index ec37168..cd1e19d 100755 --- a/sbin/grml-router +++ b/sbin/grml-router @@ -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