forked from extern/shorewall_code
More fixes for compiled programs
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@3314 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
21cfe437d0
commit
630bc7bd5d
@ -9379,6 +9379,18 @@ run_tc() {
|
||||
}
|
||||
|
||||
initialize() {
|
||||
__EOF__
|
||||
if [ -z "$EXPORT" ]; then
|
||||
cat >> $RESTOREBASE << __EOF__
|
||||
|
||||
if [ ! -f /usr/share/shorewall/version ] || [ \$(cat /usr/share/shorewall/version) != $VERSION ]; then
|
||||
error_message "ERROR: This script requires Shorewall version $VERSION"
|
||||
exit 2
|
||||
fi
|
||||
__EOF__
|
||||
fi
|
||||
|
||||
cat >> $RESTOREBASE << __EOF__
|
||||
#
|
||||
# These variables are required by the library functions called in this script
|
||||
#
|
||||
@ -9392,33 +9404,22 @@ initialize() {
|
||||
LOGFORMAT="$LOGFORMAT"
|
||||
RESTOREFILE="$RESTOREFILE"
|
||||
VERSION="$VERSION"
|
||||
IPTABLES="$IPTABLES"
|
||||
|
||||
STOPPING=
|
||||
#
|
||||
# The library requires that /var/lib/shorewall exist
|
||||
#
|
||||
mkdir -p /var/lib/shorewall
|
||||
[ -d /var/lib/shorewall ] || mkdir -p /var/lib/shorewall
|
||||
}
|
||||
|
||||
__EOF__
|
||||
if [ -n "$PROGRAM" ]; then
|
||||
save_command "define_firewall() {"
|
||||
INDENT=" "
|
||||
fi
|
||||
|
||||
if [ -z "$EXPORT" ]; then
|
||||
cat >> $RESTOREBASE << __EOF__
|
||||
|
||||
${INDENT}if [ ! -f /usr/share/shorewall/version ] || [ \$(cat /usr/share/shorewall/version) != $VERSION ]; then
|
||||
${INDENT} error_message "ERROR: This script requires Shorewall version $VERSION"
|
||||
${INDENT} exit 2
|
||||
${INDENT}fi
|
||||
__EOF__
|
||||
fi
|
||||
|
||||
cat >> $RESTOREBASE << __EOF__
|
||||
|
||||
${INDENT}load_kernel_modules
|
||||
load_kernel_modules
|
||||
|
||||
__EOF__
|
||||
|
||||
@ -9519,13 +9520,16 @@ __EOF__
|
||||
|
||||
run_user_exit started
|
||||
|
||||
if [ -n "$PROGRAM" ]; then
|
||||
INDENT=
|
||||
save_command "}"
|
||||
save_command ""
|
||||
|
||||
if [ -n "$PROGRAM" ]; then
|
||||
cat $(find_file prog.header) $RESTOREBASE $(find_file prog.footer) > $outfile
|
||||
rm $RESTOREBASE
|
||||
else
|
||||
save_command "initialize"
|
||||
save_command "define_firewall"
|
||||
mv -f $RESTOREBASE $outfile
|
||||
fi
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
# Give Usage Information #
|
||||
################################################################################
|
||||
usage() {
|
||||
echo "Usage: $0 start|stop|clear|reload|restart|status|version"
|
||||
exit 1
|
||||
echo "Usage: $0 [ -q ] [ -n ] [ start|stop|clear|reload|restart|status|version ]"
|
||||
exit $1
|
||||
}
|
||||
################################################################################
|
||||
# E X E C U T I O N B E G I N S H E R E #
|
||||
@ -12,8 +12,7 @@ initialize
|
||||
|
||||
finished=0
|
||||
|
||||
while [ $finished -eq 0 ]; do
|
||||
[ $# -eq 0 ] && usage 1
|
||||
while [ $finished -eq 0 -a $# -gt 0 ]; do
|
||||
option=$1
|
||||
case $option in
|
||||
-*)
|
||||
@ -45,11 +44,17 @@ while [ $finished -eq 0 ]; do
|
||||
done
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
usage 1
|
||||
if shorewall_is_started; then
|
||||
COMMAND=restart
|
||||
else
|
||||
COMMAND=start
|
||||
fi
|
||||
elif [ $# -gt 1 ]; then
|
||||
usage 2
|
||||
else
|
||||
COMMAND="$1"
|
||||
fi
|
||||
|
||||
COMMAND="$1"
|
||||
|
||||
case "$COMMAND" in
|
||||
start)
|
||||
echo "Starting Shorewall...."
|
||||
@ -84,7 +89,7 @@ case "$COMMAND" in
|
||||
status)
|
||||
echo "Shorewall-$VERSION Status at $HOSTNAME - $(date)"
|
||||
echo
|
||||
if iptables -L shorewall -n > /dev/null 2>&1; then
|
||||
if shorewall_is_started; then
|
||||
echo "Shorewall is running"
|
||||
status=0
|
||||
else
|
||||
@ -109,9 +114,11 @@ case "$COMMAND" in
|
||||
echo $VERSION
|
||||
status=0
|
||||
;;
|
||||
help)
|
||||
usage 0
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
status=2
|
||||
usage 2
|
||||
;;
|
||||
esac
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user