2007-03-08 05:38:37 +01:00
|
|
|
#! /usr/bin/perl -w
|
2007-03-15 22:55:22 +01:00
|
|
|
#
|
2007-06-11 23:42:58 +02:00
|
|
|
# The Shoreline Firewall4 (Shorewall-perl) Packet Filtering Firewall Compiler - V4.0
|
2007-03-15 22:55:22 +01:00
|
|
|
#
|
|
|
|
# This program is under GPL [http://www.gnu.org/copyleft/gpl.htm]
|
|
|
|
#
|
|
|
|
# (c) 2007 - Tom Eastep (teastep@shorewall.net)
|
|
|
|
#
|
|
|
|
# Complete documentation is available at http://shorewall.net
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of Version 2 of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# 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., 675 Mass Ave, Cambridge, MA 02139, USA
|
|
|
|
#
|
2007-06-13 20:40:09 +02:00
|
|
|
# Usage:
|
|
|
|
#
|
|
|
|
# compiler.pl [ <option> ... ] [ <filename> ]
|
|
|
|
#
|
|
|
|
# Options:
|
|
|
|
#
|
|
|
|
# --export # Compile for export
|
|
|
|
# --verbosity=<number> # Set VERBOSITY
|
|
|
|
# --directory=<directory> # Directory where configuration resides (default is /etc/shorewall)
|
|
|
|
# --timestamp # Timestamp all progress messages
|
2007-06-23 23:15:53 +02:00
|
|
|
# --debug # Print stack trace on warnings and fatal error.
|
2007-06-13 20:40:09 +02:00
|
|
|
#
|
2007-03-08 05:38:37 +01:00
|
|
|
use strict;
|
2007-03-28 18:19:35 +02:00
|
|
|
use lib '/usr/share/shorewall-perl';
|
2007-06-13 15:28:15 +02:00
|
|
|
use Shorewall::Compiler;
|
2007-06-11 20:07:34 +02:00
|
|
|
use Getopt::Long;
|
|
|
|
|
|
|
|
sub usage() {
|
2007-06-23 23:12:48 +02:00
|
|
|
print STDERR "usage: compiler.pl [ --export ] [ --directory=<directory> ] [ --verbose={0-2} ] [ --timestamp ] [ -- debuging ] [ <filename> ]\n";
|
2007-06-11 20:07:34 +02:00
|
|
|
exit 1;
|
|
|
|
}
|
2007-06-12 16:32:42 +02:00
|
|
|
|
2007-06-11 23:42:58 +02:00
|
|
|
#
|
2007-06-13 20:40:09 +02:00
|
|
|
# E x e c u t i o n B e g i n s H e r e
|
2007-06-11 23:42:58 +02:00
|
|
|
#
|
2007-07-08 17:58:13 +02:00
|
|
|
my $export = 0;
|
|
|
|
my $shorewall_dir = '';
|
|
|
|
my $verbose = 0;
|
|
|
|
my $timestamp = '';
|
2007-06-23 23:12:48 +02:00
|
|
|
my $debug = 0;
|
2007-06-11 20:32:47 +02:00
|
|
|
|
2007-06-12 16:32:42 +02:00
|
|
|
Getopt::Long::Configure ('bundling');
|
2007-06-11 20:07:34 +02:00
|
|
|
|
2007-06-12 01:17:02 +02:00
|
|
|
my $result = GetOptions('export' => \$export,
|
|
|
|
'e' => \$export,
|
|
|
|
'directory=s' => \$shorewall_dir,
|
|
|
|
'd=s' => \$shorewall_dir,
|
|
|
|
'verbose=i' => \$verbose,
|
|
|
|
'v=i' => \$verbose,
|
|
|
|
'timestamp' => \$timestamp,
|
2007-06-23 23:12:48 +02:00
|
|
|
't' => \$timestamp,
|
2007-06-23 23:15:53 +02:00
|
|
|
'debug' => \$debug
|
2007-06-23 23:12:48 +02:00
|
|
|
);
|
2007-06-11 20:07:34 +02:00
|
|
|
|
2007-06-12 01:17:02 +02:00
|
|
|
usage unless $result && @ARGV < 2;
|
2007-06-12 21:25:28 +02:00
|
|
|
|
2007-06-13 15:28:15 +02:00
|
|
|
my $options = 0;
|
2007-06-12 21:25:28 +02:00
|
|
|
|
2007-06-13 15:28:15 +02:00
|
|
|
$options |= EXPORT if $export;
|
|
|
|
$options |= TIMESTAMP if $timestamp;
|
2007-06-23 23:12:48 +02:00
|
|
|
$options |= DEBUG if $debug;
|
2007-06-12 21:25:28 +02:00
|
|
|
|
2007-06-13 15:28:15 +02:00
|
|
|
compiler $ARGV[0], $shorewall_dir, $verbose, $options;
|