projects
/
grml-network.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Disable default configuration in routersetup config file, use defaults in main scripts
[grml-network.git]
/
sbin
/
grml-router
diff --git
a/sbin/grml-router
b/sbin/grml-router
index
d762adc
..
cd1e19d
100755
(executable)
--- a/
sbin/grml-router
+++ b/
sbin/grml-router
@@
-1,51
+1,39
@@
#!/bin/sh
# Filename: grml-router
# Purpose: set up your box as NAT-router
#!/bin/sh
# Filename: grml-router
# Purpose: set up your box as NAT-router
-# Authors: grml-team (grml.org), Ulrich Dangel <
schula
@grml.org>, Michael Prokop <mika@grml.org>
+# Authors: grml-team (grml.org), Ulrich Dangel <
mru
@grml.org>, Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
-# Latest change: Sam Okt 07 23:18:38 CEST 2006 [mika]
################################################################################
################################################################################
-# exit on any error
-set -e
-
CONFIG_FILE=/etc/grml/routersetup
. /etc/grml/lsb-functions
. /etc/grml/net-functions
. /etc/grml/script-functions
CONFIG_FILE=/etc/grml/routersetup
. /etc/grml/lsb-functions
. /etc/grml/net-functions
. /etc/grml/script-functions
-if [ $UID != 0 ]; then
- eerror "Error: become root before starting $0"
- exit 100
-fi
+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
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
case "$OUTDEV" in
-
auto|default)
+ auto|default)
OUTDEV=$(defaultGWDev)
if [ -z "$OUTDEV" ] ; then
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
fi
;;
esac
-[ -n "$IPTABLES" ] || IPTABLES=/sbin/iptables
-
check4progs $IPTABLES || exit 1
case "$1" in
check4progs $IPTABLES || exit 1
case "$1" in