mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-22 07:33:43 +01:00
Bring 'export' command forward
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4351 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
6545adfe5b
commit
3bc36199e5
@ -576,7 +576,7 @@ mktempdir() {
|
||||
# Not all versions of the BSD mktemp support the -d option under Linux
|
||||
#
|
||||
qt rm -rf /tmp/shorewall-$$
|
||||
mkdir -p /tmp/shorewall-$$ chmod 700 /tmp/shorewall-$$ && echo /tmp/shorewall-$$
|
||||
mkdir -p /tmp/shorewall-$$ && chmod 700 /tmp/shorewall-$$ && echo /tmp/shorewall-$$
|
||||
;;
|
||||
*)
|
||||
error_message "ERROR:Internal error in mktempdir"
|
||||
|
@ -121,6 +121,27 @@ dump)
|
||||
When -x is given, that option is also passed to iptables to display actual packet and byte counts."
|
||||
;;
|
||||
|
||||
export)
|
||||
echo "export: export [ <directory1> ] <target>
|
||||
|
||||
If <directory1> is omitted, then the current working directory is assumed.
|
||||
|
||||
Causes the shorewall configuration in <directory1> to be compiled into a
|
||||
program called '<directory1>/firewall'. If compilation is successful,
|
||||
the '<directory1>/firewall' script is copied via scp to the specified
|
||||
<target>
|
||||
|
||||
<target> is of the form [user@]<system>:[<directory1>]
|
||||
|
||||
Example:
|
||||
|
||||
shorewall export admin@gateway:~
|
||||
|
||||
This command would compile the configuration in the current working directory
|
||||
then copy the 'firewall' (and firewall.conf) files to admin's home directory
|
||||
on system 'gateway'"
|
||||
;;
|
||||
|
||||
forget)
|
||||
echo "forget: forget [ <file name> ]
|
||||
Deletes /var/lib/shorewall/<file name>. If no <file name> is given then
|
||||
|
@ -266,7 +266,7 @@ chmod 755 ${PREFIX}/usr/share/shorewall/configfiles
|
||||
#
|
||||
run_install $OWNERSHIP -m 0644 shorewall.conf ${PREFIX}/usr/share/shorewall/configfiles/shorewall.conf
|
||||
|
||||
qt mywhich perl && perl -p -w -i -e 's|^CONFIG_PATH=.*|CONFIG_PATH=/usr/share/shorewall/configfiles:/usr/share/shorewall|;' /usr/share/shorewall/configfiles/shorewall.conf
|
||||
qt mywhich perl && perl -p -w -i -e 's|^CONFIG_PATH=.*|CONFIG_PATH=/usr/share/shorewall/configfiles:/usr/share/shorewall|;' ${PREFIX}/usr/share/shorewall/configfiles/shorewall.conf
|
||||
|
||||
if [ ! -f ${PREFIX}/etc/shorewall/shorewall.conf ]; then
|
||||
run_install $OWNERSHIP -m 0644 shorewall.conf ${PREFIX}/etc/shorewall/shorewall.conf
|
||||
|
@ -1377,6 +1377,71 @@ reload_command() # $* = original arguments less the command.
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Export command executor
|
||||
#
|
||||
export_command() # $* = original arguments less the command.
|
||||
{
|
||||
local verbose=$(make_verbose) file= finished=0 directory target
|
||||
|
||||
while [ $finished -eq 0 -a $# -gt 0 ]; do
|
||||
option=$1
|
||||
case $option in
|
||||
-*)
|
||||
option=${option#-}
|
||||
|
||||
while [ -n "$option" ]; do
|
||||
case $option in
|
||||
-)
|
||||
finished=1
|
||||
option=
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
finished=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
case $# in
|
||||
1)
|
||||
directory="."
|
||||
target=$1
|
||||
;;
|
||||
2)
|
||||
directory=$1
|
||||
target=$2
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
|
||||
case $target in
|
||||
*:*)
|
||||
;;
|
||||
*)
|
||||
fatal_error "Target must be of the form [user@]<system>:[<directory>]"
|
||||
;;
|
||||
esac
|
||||
|
||||
file=$(resolve_file $directory/firewall)
|
||||
|
||||
if shorewall $debugging $verbose compile -e $directory $directory/firewall && \
|
||||
echo "Copying $file and ${file}.conf to ${target#*@}..." && \
|
||||
scp $directory/firewall $directory/firewall.conf $target
|
||||
then
|
||||
progress_message3 "Copy complete"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Help information
|
||||
#
|
||||
@ -1399,6 +1464,7 @@ usage() # $1 = exit status
|
||||
echo " compile [ -e ] [ <directory name> ] <path name>"
|
||||
echo " drop <address> ..."
|
||||
echo " dump [ -x ]"
|
||||
echo " export [ <directory1> ] [<user>@]<system>:[<directory2>]"
|
||||
echo " forget [ <file name> ]"
|
||||
echo " help [ <command > | host | address ]"
|
||||
echo " hits"
|
||||
@ -1717,6 +1783,10 @@ case "$COMMAND" in
|
||||
shift
|
||||
reload_command $@
|
||||
;;
|
||||
export)
|
||||
shift
|
||||
export_command $@
|
||||
;;
|
||||
status)
|
||||
[ $# -eq 1 ] || usage 1
|
||||
echo "Shorewall-$version Status at $HOSTNAME - $(date)"
|
||||
|
Loading…
Reference in New Issue
Block a user