diff options
author | ru <ru@FreeBSD.org> | 2001-06-18 12:35:14 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2001-06-18 12:35:14 +0000 |
commit | fd0a00a7295105bd1c94ad22b13d090c15c702a4 (patch) | |
tree | db9091ee1bbb36350d89e60c839e346e91ed8d2c /share/examples | |
parent | 45b878b72d9ebd68ca268cb6178624fde8e887c4 (diff) | |
download | FreeBSD-src-fd0a00a7295105bd1c94ad22b13d090c15c702a4.zip FreeBSD-src-fd0a00a7295105bd1c94ad22b13d090c15c702a4.tar.gz |
Make this really work.
Diffstat (limited to 'share/examples')
-rwxr-xr-x | share/examples/ipfw/change_rules.sh | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/share/examples/ipfw/change_rules.sh b/share/examples/ipfw/change_rules.sh index ee6f0c8..b607b36 100755 --- a/share/examples/ipfw/change_rules.sh +++ b/share/examples/ipfw/change_rules.sh @@ -82,16 +82,16 @@ restore_rules() { exit } -if [ -f /etc/${firewall_script}.new ]; then +if [ -f ${firewall_script}.new ]; then get_yes_no "A new rules file already exists, do you want to use it" - [ $a = 'No' ] && cp ${firewall_script} /etc/${firewall_script}.new + [ $a = 'No' ] && cp ${firewall_script} ${firewall_script}.new else - cp ${firewall_script} /etc/${firewall_script}.new + cp ${firewall_script} ${firewall_script}.new fi trap restore_rules SIGHUP -${EDITOR} /etc/${firewall_script}.new +${EDITOR} ${firewall_script}.new get_yes_no "Do you want to install the new rules" @@ -105,19 +105,19 @@ The TCP/IP connections might be broken during the change. If so, restore the ssh/telnet connection being used. ! -nohup sh /etc/${firewall_script}.new > /tmp/${firewall_script}.out 2>&1; +nohup sh ${firewall_script}.new > /tmp/`basename ${firewall_script}`.out 2>&1; sleep 2; get_yes_no "Would you like to see the resulting new rules" -[ $a = 'Yes' ] && ${EDITOR} /tmp/${firewall_script}.out +[ $a = 'Yes' ] && ${EDITOR} /tmp/`basename ${firewall_script}`.out get_yes_no "Type y to keep the new rules" [ $a != 'Yes' ] && restore_rules DATE=`date "+%Y%m%d%H%M"` -cp ${firewall_script} /etc/${firewall_script}.$DATE -mv /etc/${firewall_script}.new ${firewall_script} +cp ${firewall_script} ${firewall_script}.$DATE +mv ${firewall_script}.new ${firewall_script} cat <<! The new rules are now default. The previous rules have been preserved in -the file /etc/${firewall_script}.$DATE +the file ${firewall_script}.$DATE ! -diff -F "^# .*[A-Za-z]" -u /etc/${firewall_script}.$DATE ${firewall_script} | mail -s "`hostname` Firewall rule change" root +diff -F "^# .*[A-Za-z]" -u ${firewall_script}.$DATE ${firewall_script} | mail -s "`hostname` Firewall rule change" root |