Try to ensure that cp doesn't copy the firewall script to itself.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-05-06 09:22:16 -07:00
parent ea71f15b3d
commit 56318e6cc8
2 changed files with 5 additions and 1 deletions

View File

@ -272,8 +272,11 @@ shorewall6_is_started() {
# Echos the fully-qualified name of the calling shell program
#
my_pathname() {
local pwd
pwd=$PWD
cd $(dirname $0)
echo $PWD/$(basename $0)
cd $pwd
}
#

View File

@ -534,7 +534,8 @@ EOF
run_start_exit
do_iptables -N shorewall
set_state Started $config_dir
[ \$0 = \${VARDIR}/firewall ] || cp -f \$(my_pathname) \${VARDIR}/firewall
my_pathname=\$(my_pathname)
[ \$my_pathname = \${VARDIR}/firewall ] || cp -f \$my_pathname \${VARDIR}/firewall
run_started_exit
fi
EOF