mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-30 19:43:45 +01:00
d9b400b313
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@7296 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
117 lines
2.1 KiB
Bash
Executable File
117 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $Id: install_shoregen,v 1.5 2004/04/22 11:12:51 paulgear Exp $
|
|
#
|
|
# Wrapper script to install shoregen-generated shorewall configuration files.
|
|
#
|
|
|
|
#
|
|
# (c) Copyright 2004 Paul D. Gear <paul@gear.dyndns.org>
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by the
|
|
# Free Software Foundation; either version 2 of the License, or (at your
|
|
# option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
# Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
|
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txtl> on the World Wide Web.
|
|
|
|
VERBOSE=0
|
|
RESTART=0
|
|
CHECK=1
|
|
TIME=0
|
|
|
|
usage()
|
|
{
|
|
echo "Usage: $0 [--verbose] [--restart] host ...
|
|
Generates and installs shorewall configuration on the given hosts" >&2
|
|
exit 1
|
|
}
|
|
|
|
error()
|
|
{
|
|
echo "$0: ERROR -" "$@" >&2
|
|
}
|
|
|
|
while :; do
|
|
case "$1" in
|
|
|
|
-v|--verbose)
|
|
VERBOSE=1
|
|
shift
|
|
;;
|
|
|
|
-r|--restart)
|
|
RESTART=1
|
|
shift
|
|
;;
|
|
|
|
-c|--nocheck)
|
|
CHECK=0
|
|
shift
|
|
;;
|
|
|
|
-t|--notime)
|
|
TIME=0
|
|
shift
|
|
;;
|
|
|
|
--)
|
|
shift
|
|
break 2
|
|
;;
|
|
|
|
--*)
|
|
error "Unrecognised option $1"
|
|
usage
|
|
;;
|
|
|
|
*)
|
|
break 2
|
|
;;
|
|
|
|
esac
|
|
done
|
|
|
|
set -e
|
|
set -u
|
|
|
|
if [ "$#" -lt 1 ]; then
|
|
usage
|
|
fi
|
|
|
|
USER=root
|
|
RSYNC_ARGS="--recursive --backup --times --cvs-exclude --rsh=ssh"
|
|
#--progress
|
|
if [ "$VERBOSE" -gt 0 ]; then
|
|
RSYNC_ARGS="$RSYNC_ARGS --verbose"
|
|
fi
|
|
DIR=/etc/shorewall
|
|
SW_PATH=/sbin/shorewall
|
|
|
|
PATH=$PATH:
|
|
|
|
if [ "$TIME" -gt 0 ]; then
|
|
TIME="time"
|
|
else
|
|
TIME=""
|
|
fi
|
|
|
|
for HOST; do
|
|
shoregen $HOST
|
|
rsync $RSYNC_ARGS SPOOL/$HOST/ $USER@$HOST:$DIR/
|
|
if [ "$CHECK" -gt 0 ]; then
|
|
$TIME ssh -l $USER -t $HOST $SW_PATH check
|
|
fi
|
|
if [ "$RESTART" -gt 0 ]; then
|
|
$TIME ssh -l $USER -t $HOST $SW_PATH restart
|
|
fi
|
|
done
|