Implement new generate syntax

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@3239 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2006-01-07 04:05:16 +00:00
parent af973cf234
commit 1898b6cb8a
2 changed files with 33 additions and 5 deletions

View File

@ -112,7 +112,7 @@ forget)
;;
generate)
echo "generate: generate [ -d <directory name> ] <file name>
echo "generate: generate [ <directory name> ] <file name>
Compiles the current configuration into the executable file
/var/lib/shorewall/<file name>"
;;

View File

@ -108,7 +108,8 @@
# confirmation to accept or reject the new
# configuration
#
# shorewall generate <filename> Compile a pseudo restore file.
# shorewall generate [ <directory> ] ]<filename>
# Compile a pseudo restore file.
#
# Fatal Error
#
@ -505,7 +506,7 @@ usage() # $1 = exit status
echo " drop <address> ..."
echo " dump"
echo " forget [ <file name> ]"
echo " generate [ <file name> ]"
echo " generate [ <directory name> ] <file name>"
echo " help [ <command > | host | address ]"
echo " hits"
echo " ipcalc { <address>/<vlsm> | <address> <netmask> }"
@ -815,8 +816,35 @@ case "$1" in
exec $SHOREWALL_SHELL $FIREWALL $debugging $nolock $1
;;
generate)
[ $# -ne 2 ] && usage 1
exec $SHOREWALL_SHELL $FIREWALL $debugging generate $2
file=
case $# in
1)
usage 1
;;
2)
file=$2
;;
3)
[ -n "$SHOREWALL_DIR" ] && usage 2
if [ ! -d $2 ]; then
if [ -e $2 ]; then
echo "$2 is not a directory" >&2 && exit 2
else
echo "Directory $2 does not exist" >&2 && exit 2
fi
fi
SHOREWALL_DIR=$2
export SHOREWALL_DIR
file=$3
;;
*)
usage 1
;;
esac
exec $SHOREWALL_SHELL $FIREWALL $debugging generate $file
;;
check|restart)
case $# in