mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-27 10:03:41 +01:00
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() {
|
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
|
# These variables are required by the library functions called in this script
|
||||||
#
|
#
|
||||||
@ -9392,33 +9404,22 @@ initialize() {
|
|||||||
LOGFORMAT="$LOGFORMAT"
|
LOGFORMAT="$LOGFORMAT"
|
||||||
RESTOREFILE="$RESTOREFILE"
|
RESTOREFILE="$RESTOREFILE"
|
||||||
VERSION="$VERSION"
|
VERSION="$VERSION"
|
||||||
|
IPTABLES="$IPTABLES"
|
||||||
|
|
||||||
STOPPING=
|
STOPPING=
|
||||||
#
|
#
|
||||||
# The library requires that /var/lib/shorewall exist
|
# The library requires that /var/lib/shorewall exist
|
||||||
#
|
#
|
||||||
mkdir -p /var/lib/shorewall
|
[ -d /var/lib/shorewall ] || mkdir -p /var/lib/shorewall
|
||||||
}
|
}
|
||||||
|
|
||||||
__EOF__
|
__EOF__
|
||||||
if [ -n "$PROGRAM" ]; then
|
|
||||||
save_command "define_firewall() {"
|
save_command "define_firewall() {"
|
||||||
INDENT=" "
|
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__
|
cat >> $RESTOREBASE << __EOF__
|
||||||
|
|
||||||
${INDENT}load_kernel_modules
|
load_kernel_modules
|
||||||
|
|
||||||
__EOF__
|
__EOF__
|
||||||
|
|
||||||
@ -9519,13 +9520,16 @@ __EOF__
|
|||||||
|
|
||||||
run_user_exit started
|
run_user_exit started
|
||||||
|
|
||||||
if [ -n "$PROGRAM" ]; then
|
|
||||||
INDENT=
|
INDENT=
|
||||||
save_command "}"
|
save_command "}"
|
||||||
save_command ""
|
save_command ""
|
||||||
|
|
||||||
|
if [ -n "$PROGRAM" ]; then
|
||||||
cat $(find_file prog.header) $RESTOREBASE $(find_file prog.footer) > $outfile
|
cat $(find_file prog.header) $RESTOREBASE $(find_file prog.footer) > $outfile
|
||||||
rm $RESTOREBASE
|
rm $RESTOREBASE
|
||||||
else
|
else
|
||||||
|
save_command "initialize"
|
||||||
|
save_command "define_firewall"
|
||||||
mv -f $RESTOREBASE $outfile
|
mv -f $RESTOREBASE $outfile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
# Give Usage Information #
|
# Give Usage Information #
|
||||||
################################################################################
|
################################################################################
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: $0 start|stop|clear|reload|restart|status|version"
|
echo "Usage: $0 [ -q ] [ -n ] [ start|stop|clear|reload|restart|status|version ]"
|
||||||
exit 1
|
exit $1
|
||||||
}
|
}
|
||||||
################################################################################
|
################################################################################
|
||||||
# E X E C U T I O N B E G I N S H E R E #
|
# 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
|
finished=0
|
||||||
|
|
||||||
while [ $finished -eq 0 ]; do
|
while [ $finished -eq 0 -a $# -gt 0 ]; do
|
||||||
[ $# -eq 0 ] && usage 1
|
|
||||||
option=$1
|
option=$1
|
||||||
case $option in
|
case $option in
|
||||||
-*)
|
-*)
|
||||||
@ -45,11 +44,17 @@ while [ $finished -eq 0 ]; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
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
|
fi
|
||||||
|
|
||||||
COMMAND="$1"
|
|
||||||
|
|
||||||
case "$COMMAND" in
|
case "$COMMAND" in
|
||||||
start)
|
start)
|
||||||
echo "Starting Shorewall...."
|
echo "Starting Shorewall...."
|
||||||
@ -84,7 +89,7 @@ case "$COMMAND" in
|
|||||||
status)
|
status)
|
||||||
echo "Shorewall-$VERSION Status at $HOSTNAME - $(date)"
|
echo "Shorewall-$VERSION Status at $HOSTNAME - $(date)"
|
||||||
echo
|
echo
|
||||||
if iptables -L shorewall -n > /dev/null 2>&1; then
|
if shorewall_is_started; then
|
||||||
echo "Shorewall is running"
|
echo "Shorewall is running"
|
||||||
status=0
|
status=0
|
||||||
else
|
else
|
||||||
@ -109,9 +114,11 @@ case "$COMMAND" in
|
|||||||
echo $VERSION
|
echo $VERSION
|
||||||
status=0
|
status=0
|
||||||
;;
|
;;
|
||||||
|
help)
|
||||||
|
usage 0
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
usage
|
usage 2
|
||||||
status=2
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user