3 ### Failsafe prologue for firewall scripts
5 ### (c) 2008 Mark Wooding
8 ###----- Licensing notice ---------------------------------------------------
10 ### This program is free software; you can redistribute it and/or modify
11 ### it under the terms of the GNU General Public License as published by
12 ### the Free Software Foundation; either version 2 of the License, or
13 ### (at your option) any later version.
15 ### This program is distributed in the hope that it will be useful,
16 ### but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ### GNU General Public License for more details.
20 ### You should have received a copy of the GNU General Public License
21 ### along with this program; if not, write to the Free Software Foundation,
22 ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 ###--------------------------------------------------------------------------
26 ### Failsafe prologue.
29 echo "$1! Retreating to safe version..."
30 if ! "$firewall_failsafe" revert; then
31 echo >&2 "Safe firewall failed. You're screwed. Good luck."
34 echo >&2 "Phew! Fallback to safe version successful."
44 export FWCOOKIE=magical
46 start | restart | reload | force-reload)
47 echo -n "Starting up firewall... "
48 "$firewall_script" install || revert "Failed"
52 echo -n "Shutting down firewall... "
53 exit_after_clearing=finished
56 echo -n "Installing new firewall... "
57 "$firewall_script" install || revert "Failed"
59 echo "Can you hear me?"
61 (sleep 5; kill $parent; revert "Timeout")&
67 echo "Cool. We're done here."
76 echo >&2 "Usage: firewall start|stop|reload|restart|force-reload|update|install|revert"
82 ###----- That's all, folks --------------------------------------------------