Add startup_error() function to generated program

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@3369 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2006-01-24 15:53:07 +00:00
parent 657ec591f2
commit 21a4d1cebb

View File

@ -1041,7 +1041,7 @@ ${INDENT}if [ -n "\$addr" ]; then
${INDENT} addr=\$(echo \$addr | sed 's/inet //;s/\/.*//;s/ peer.*//') ${INDENT} addr=\$(echo \$addr | sed 's/inet //;s/\/.*//;s/ peer.*//')
${INDENT} for network in 10.0.0.0/8 176.16.0.0/12 192.168.0.0/16; do ${INDENT} for network in 10.0.0.0/8 176.16.0.0/12 192.168.0.0/16; do
${INDENT} if in_network \$addr \$network; then ${INDENT} if in_network \$addr \$network; then
${INDENT} fatal_error "The 'norfc1918' option has been specified on an interface with an RFC 1918 address. Interface:$interface" ${INDENT} startup_error "The 'norfc1918' option has been specified on an interface with an RFC 1918 address. Interface:$interface"
${INDENT} fi ${INDENT} fi
${INDENT} done ${INDENT} done
${INDENT}fi ${INDENT}fi
@ -8386,6 +8386,13 @@ fatal_error()
exit 2 exit 2
} }
startup_error() # $* = Error Message
{
echo " ERROR: \$@" >&2
kill \$\$
exit 2
}
run_iptables() run_iptables()
{ {
if ! \$IPTABLES \$@; then if ! \$IPTABLES \$@; then
@ -8417,8 +8424,7 @@ __EOF__
if [ -z "$EXPORT" ]; then if [ -z "$EXPORT" ]; then
cat >> $RESTOREBASE << __EOF__ cat >> $RESTOREBASE << __EOF__
if [ ! -f /usr/share/shorewall/version ] || [ \$(cat /usr/share/shorewall/version) != $VERSION ]; then if [ ! -f /usr/share/shorewall/version ] || [ \$(cat /usr/share/shorewall/version) != $VERSION ]; then
error_message "ERROR: This script requires Shorewall version $VERSION" startup_error "This script requires Shorewall version $VERSION"
exit 2
fi fi
__EOF__ __EOF__
@ -8428,8 +8434,8 @@ __EOF__
# #
# These variables are required by the library functions called in this script # These variables are required by the library functions called in this script
# #
[ -n \${COMMAND:=restart} ] [ -n "\${COMMAND:=restart}" ]
VERBOSE=\${VERBOSE:=0} [ -n "\${VERBOSE:=0}" ]
MODULESDIR="$MODULESDIR" MODULESDIR="$MODULESDIR"
MODULE_SUFFIX="$MODULE_SUFFIX" MODULE_SUFFIX="$MODULE_SUFFIX"
LOGLIMIT="$LOGLIMIT" LOGLIMIT="$LOGLIMIT"