Begin modularization again

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4450 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2006-08-27 18:16:55 +00:00
parent fa8fc4e935
commit 4a26e098be
3 changed files with 71 additions and 8 deletions

View File

@ -8270,6 +8270,14 @@ __EOF__
}
#
# Give Usage Information
#
usage() {
echo "Usage: $0 [debug] check|compile <filename>}"
exit 1
}
#
# E X E C U T I O N B E G I N S H E R E
#

View File

@ -1742,6 +1742,41 @@ strip_file() # $1 = Base Name of the file, $2 = Full Name of File (optional)
fi
}
#
# Load an optional library
#
lib_load() # $1 = Name of the Library, $2 = Error Message heading if the library cannot be found
{
local lib=${SHAREDIR}/lib.$1
local loaded
eval loaded=\$LIB_${1}_LOADED
if [ -z "$loaded" ]; then
if [ -f $lib ]; then
. $lib
eval LIB_${1}_LOADED=Yes
else
startup_error "$2 requires the Shorewall library $1 ($lib) which is not installed"
fi
fi
}
#
# Determine if an optional library is available
#
lib_avail() # $1 = Name of the Library
{
[ -f ${SHAREDIR}/lib.$1 ]
}
strip_file_and_lib_load() # $1 = logical file name, $3 = Error message heading if the library cannot be found
{
strip_file $1
[ -s $TMP_DIR/$1 ] && lib_load $2 "$3"
}
#
# Note: The following set of IP address manipulation functions have anomalous
# behavior when the shell only supports 32-bit signed arithmatic and
@ -3125,12 +3160,4 @@ do_initialize() {
qt mywhich awk && HAVEAWK=Yes || HAVEAWK=
}
#
# Give Usage Information
#
usage() {
echo "Usage: $0 [debug] check|compile <filename>}"
exit 1
}
SHOREWALL_LIBRARY=Loaded

View File

@ -0,0 +1,28 @@
#!/bin/sh
#
# Shorewall 3.2 -- /usr/share/shorewall/lib.dynamicrules
#
# This program is under GPL [http://www.gnu.org/copyleft/gpl.htm]
#
# (c) 1999,2000,2001,2002,2003,2004,2005,2006 - Tom Eastep (teastep@shorewall.net)
#
# tcstart from tc4shorewall Version 0.5
# (c) 2005 Arne Bernin <arne@ucbering.de>
# Modified by Tom Eastep for integration into the Shorewall distribution
# published under GPL Version 2#
#
# Complete documentation is available at http://shorewall.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of Version 2 of the GNU General Public License
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA