git-svn-id: http://svn.ipfire.org/svn/ipfire/IPFire/source@16 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

This commit is contained in:
ipfire
2006-02-15 21:15:54 +00:00
parent 6d63f4c4b3
commit cd1a292722
1206 changed files with 185026 additions and 0 deletions

7
tools/CVS/Entries Normal file
View File

@@ -0,0 +1,7 @@
/check_langs.sh/1.2/Thu Dec 11 11:08:47 2003//TIPCOP_v1_4_0
/check_strings.pl/1.1.2.4/Mon Feb 28 19:35:03 2005//TIPCOP_v1_4_0
/cvs2cl.pl/1.1.2.1/Thu Aug 12 23:40:08 2004//TIPCOP_v1_4_0
/cvs2sql.pl/1.2/Thu Dec 11 11:08:47 2003//TIPCOP_v1_4_0
/fetchlangs.pl/1.2/Thu Dec 11 11:08:47 2003//TIPCOP_v1_4_0
/perfTest.sh/1.1.2.1/Wed Jan 26 19:43:36 2005//TIPCOP_v1_4_0
D/mkflash////

1
tools/CVS/Repository Normal file
View File

@@ -0,0 +1 @@
ipcop/tools

1
tools/CVS/Root Normal file
View File

@@ -0,0 +1 @@
:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ipcop

1
tools/CVS/Tag Normal file
View File

@@ -0,0 +1 @@
TIPCOP_v1_4_0

32
tools/check_langs.sh Normal file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
if [ ! -d ./langs/ ]; then
echo "Script can only be started from IPCop Source base directory"
exit 1
fi
cat ./langs/en/cgi-bin/en.pl | grep \'.*\' | awk -F\' '{print $2}'| sort > /tmp/en_cgi-bin.$$
cat ./langs/en/install/lang_en.c | grep TR_ | awk -F\ '{print $2}' > /tmp/en_install.$$
for i in ./langs/[a-z]*; do
if [ "$i" == "./langs/CVS" ] ; then continue; fi
language=`echo "$i" | awk -F/ '{ print $3 }'`
echo "############################################################################"
echo "# Checking install/setup translations for language: ${language} #"
echo "############################################################################"
cat ./langs/${language}/install/lang_${language}.c | grep TR_ | awk -F\ '{print $2}' | \
diff /tmp/en_install.$$ - | grep \<
echo "############################################################################"
echo "# Checking cgi-bin translations for language: ${language} #"
echo "############################################################################"
cat ./langs/${language}/cgi-bin/${language}.pl | grep \'.*\' | awk -F\' '{print $2}' | sort | \
diff /tmp/en_cgi-bin.$$ - | grep \<
done
rm -f /tmp/en_cgi-bin.$$
rm -f /tmp/en_install.$$
exit 0

62
tools/check_strings.pl Normal file
View File

@@ -0,0 +1,62 @@
#!/usr/bin/perl
#
############################################################################
# #
# This file is part of the IPCop Firewall. #
# #
# IPCop 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. #
# #
# IPCop 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 IPCop; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
# Copyright (C) 2004-03-12 Mark Wormgoor <mark@wormgoor.com> #
# #
############################################################################
#
# $Id: check_strings.pl,v 1.1.2.4 2005/02/28 19:35:03 eoberlander Exp $
#
my (%tr2, $basedir);
use Cwd;
use File::Find;
$basedir = cwd();
require "${basedir}/langs/en/cgi-bin/en.pl";
sub wanted {
if ( -f $File::Find::name && open(FILE, $File::Find::name)) {
while (<FILE>) {
while ($_ =~ /\$Lang::tr{'([A-Za-z0-9,:_\s\/\.-]+)'}/g) {
$tr2{$1} = 'empty string';
}
}
close(FILE);
}
}
## Main
find (\&wanted, $basedir );
for my $key ( sort (keys %tr) ) {
my $value = $tr{$key};
if (! $tr2{$key}) {
print "WARNING: translation string unused: $key\n";
}
}
for my $key ( sort(keys %tr2) ) {
my $value = $tr2{$key};
if (! $tr{$key}) {
print "WARNING: untranslated string: $key\n";
}
}

3174
tools/cvs2cl.pl Normal file

File diff suppressed because it is too large Load Diff

89
tools/cvs2sql.pl Normal file
View File

@@ -0,0 +1,89 @@
#!/usr/bin/perl
#
# This file is part of the IPCop Firewall.
#
# IPCop 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.
#
# IPCop 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 IPCop; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Copyright (C) 2003-02-04 Mark Wormgoor <mark@wormgoor.com>
#
# Usage:
#
# ./tools/cvs2sql.pl | grep -e INSERT -e UPDATE > lang_data.sql
#
# Get time
($sec, $min, $hour, $day, $month, $year, $weekday, $dayofyear, $isdst) = localtime(time);
$year += 1900;
if ($month < 10) { $month = "0" . $month; }
if ($day < 10) { $day = "0" . $day; }
if ($hour < 10) { $hour = "0" . $hour; }
if ($min < 10) { $min = "0" . $min; }
if ($sec < 10) { $sec = "0" . $sec; }
$lastchange = "$year$month$day$hour$sec";
# Read English install file
undef $/;
open (FILE, "langs/en/install/lang_en.c") or die "Couldn't open English language file";
$file = <FILE>;
close (FILE);
$file =~ s/"\s*\\\s*\n"//g;
$file =~ s/",/"/g;
$file =~ s/\\n/\\\\n/g;
$file =~ s/^.*(TR_[\w]+).*$/$1/gm;
$file =~ s/(TR_\w+)\n(.*$)/INSERT INTO Lang_Data (VarName, EN_Word, Section, LastChange) Values ("$1", $2, "SETUP", "$lastchange");/gm;
print "$file";
# Read English Perl file
do "langs/en/cgi-bin/en.pl" or die "Failed to open English web language file";
while( my ($key, $value) = each(%tr) ) {
$key = lc($key);
$value =~ s/\n//mg;
$value =~ s/\\*\"/\\"/g;
print "INSERT INTO Lang_Data (VarName, EN_Word, Section, LastChange) Values (\"$key\", \"$value\", \"WEB\", \"$lastchange\");\n";
}
# Other language install files
while (($trans = glob("langs/*/install/lang_*.c") )) {
if ( $trans =~ /lang_en.c/ ) { next; }
if ( $trans =~ /lang_el.c/ ) { next; }
open (FILE, "$trans") or die "Couldn't open language file: $trans";
$file = <FILE>;
close (FILE);
$trans =~ s/.*lang_(.*).c/$1/;
$trans = uc($trans);
$file =~ s/"\s*\\\s*\n"//g;
$file =~ s/",/"/g;
$file =~ s/\\n/\\\\n/g;
$file =~ s/^.*(TR_[\w]+).*$/$1/gm;
$file =~ s/(TR_\w+)\n(.*$)/UPDATE Lang_Data set ${trans}_Word = $2 where VarName = "$1";/gm;
print "$file";
}
# Other language perl files
while (($trans = glob("langs/*/cgi-bin/*.pl") )) {
if ( $trans =~ /en.pl/ ) { next; }
if ( $trans =~ /el.pl/ ) { next; }
%tr=();
do "$trans" or die "Failed to load translation file: $trans";
$trans =~ s/.*\/(\w+).pl/$1/;
$trans = uc($trans);
while( my ($key, $value) = each(%tr) ) {
$key = lc($key);
$value =~ s/\n//mg;
$value =~ s/\\*\"/\\"/g;
print "UPDATE Lang_Data set ${trans}_Word = \"$value\" where VarName = \"$key\";\n";
}
}

37
tools/fetchlangs.pl Normal file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/perl
#
# This file is part of the IPCop Firewall.
#
# IPCop 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.
#
# IPCop 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 IPCop; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Copyright (C) 2003-03-09 Mark Wormgoor <mark@wormgoor.com>
#
open(LIST, "./langs/list") or die 'Unable to open language list ./langs/list';
while (<LIST>) {
next if $_ =~ m/^#/;
@temp = split(/:/,$_);
$lang = $temp[0];
$uclang = uc($lang);
print "Downloading files for " . $temp[1] . "\n";
system ('wget','--quiet','-N','-c','--cache=off',"http://www.ipcop.org/langs/create-c.php?Lang=${uclang}");
rename ("create-c.php?Lang=${uclang}", "langs/${lang}/install/lang_${lang}.c") or die
'Failed to rename downloaded file: langs/${lang}/install/lang_${lang}.c';
system ('wget','--quiet','-N','-c','--cache=off',"http://www.ipcop.org/langs/create-pl.php?Lang=${uclang}");
rename ("create-pl.php?Lang=${uclang}", "langs/${lang}/cgi-bin/${lang}.pl") or die
'Failed to rename downloaded file: langs/${lang}/cgi-bin/${lang}.pl';
}
close (LIST)

View File

@@ -0,0 +1,4 @@
/logrotate.conf/1.3/Fri Jan 30 08:48:14 2004//TIPCOP_v1_4_0
/mkflash/1.6.2.12/Sat Aug 13 15:15:54 2005//TIPCOP_v1_4_0
/settings.8139/1.1.2.1/Tue Aug 31 13:06:44 2004//TIPCOP_v1_4_0
D

View File

@@ -0,0 +1 @@
ipcop/tools/mkflash

1
tools/mkflash/CVS/Root Normal file
View File

@@ -0,0 +1 @@
:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ipcop

1
tools/mkflash/CVS/Tag Normal file
View File

@@ -0,0 +1 @@
TIPCOP_v1_4_0

View File

@@ -0,0 +1,84 @@
# rotate log files weekly
weekly
# keep 2 weeks worth of backlogs
rotate 2
# create new (empty) log files after rotating old ones
create
# Maximum logfile size of 1MB
size 1M
# uncomment this if you want your log files compressed
compress
# wtmp
/var/log/wtmp {
weekly
create 0664 root utmp
rotate 1
}
/var/log/httpd/access_log /var/log/httpd/error_log /var/log/httpd/ssl_request_log /var/log/httpd/ssl_engine_log {
missingok
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
endscript
}
/var/log/snort/alert {
weekly
copytruncate
ifempty
missingok
}
/var/log/snort/scan.log {
weekly
copytruncate
compress
ifempty
missingok
postrotate
/usr/bin/find /var/log/snort -path '/var/log/snort/[0-9]*' -prune -exec rm -rf {} \;
/usr/local/bin/restartsnort
endscript
}
/var/log/squid/access.log {
weekly
copytruncate
ifempty
missingok
}
/var/log/squid/cache.log {
weekly
rotate 3
copytruncate
compress
missingok
}
/var/log/squid/store.log {
weekly
rotate 3
copytruncate
compress
missingok
postrotate
/bin/chmod -R ugo+rX /var/log/squid
/usr/sbin/squid -k rotate
endscript
}
/var/log/messages /var/log/boot.log {
sharedscripts
ifempty
postrotate
/bin/chmod ugo+rX /var/log/messages
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}

460
tools/mkflash/mkflash Normal file
View File

@@ -0,0 +1,460 @@
#!/bin/bash
#
# This file is part of the IPCop Firewall.
#
# IPCop 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.
#
# IPCop 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 IPCop; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Originally by Guy Ellis and Steve Bauer
# Copyright 2001 Traverse Technologies Australia - http://www.traverse.com.au/
#
# Copyright (C) 2002-04-08 Mark Wormgoor <mark@wormgoor.com>
# - Modified to use loopback filesystem
# - Modified to easily change partition sizes
# Copyright (C) 2003-04-04 Nick Shore <nick.shore@multithread.co.uk>
# - Added disksize calculations
# Copyright (C) 2003-04-09 Simon Turner <simont@angledata.co.uk>
# - Modified to easily change partition sizes and fix
# some bugs.
# Copyright (C) 2004-01-29 Mark Wormgoor <mark@wormgoor.com>
# - Modified for IPCop 1.4 (grub, etc)
# Copyright (C) 2004-08-17 Dale Haag <dhaag@net-defender.net>
# - Fixed grub stage2 problem for CF disks
# - Added command line option to select target CF drive
# - Modified for creating 256mb, 512mb and 1gb CF disks
# - Modified routines for building sym links
# - Added ability to define kernel loading parameters needed for large CF disks
# - Added ability to define grub install parameters needed for large CF disks
# - Flash file is created as /tmp/[size]flash.img to allow storing multiple development images
# Copyright (C) 2004-08-30 Dale Haag <dhaag@net-defender.net>
# - Fixed issue with ramdisk sym link not properly being created for rc.flash.up
# - Added ability to configure ethernet settings for a LEX with 3 RTL8139 during flash build
# Copyright (C) 2005-08-13 Gilles Espinasse <g.esp.ipcop@free.fr>
# - Use a bigger /boot partition to allow easier kernel upgrade and support smp kernel
# - Define zlog_MB at 30MB for 512 and 1gb like with 256 flash
# Features
# - ext3 file system
# - auto grub install to CF
# - compressed logs on flash + log to ramdisk
#
# Some SiS chipset don't like ide=nodma parameter (bug SF 1098510), remove in case of problem
VERSION="0.4.3"
SIZE="$1"
CF="$2"
# See what we're supposed to do
# 32 & 64 are too small now for this current script and IPCop 1.4.0
case "$SIZE" in
#32)
# echo "`date '+%b %e %T'`: Creating 32MB Compact Flash"
# flash_MB=30
# ramdisk_MB=64
# boot_MB=3
# zlog_MB=4
# root_MB=$(( $flash_MB - $boot_MB - $zlog_MB ))
# heads=8
# sectors=32
# ;;
#64)
# echo "`date '+%b %e %T'`: Creating 64MB Compact Flash"
# flash_MB=61
# ramdisk_MB=64
# boot_MB=3
# zlog_MB=4
# root_MB=$(( $flash_MB - $boot_MB - $zlog_MB ))
# heads=8
# sectors=32
# ;;
128)
echo "`date '+%b %e %T'`: Creating 128MB Compact Flash"
flash_MB=122
ramdisk_MB=64
boot_MB=8
zlog_MB=10
root_MB=$(( $flash_MB - $boot_MB - $zlog_MB ))
heads=8
sectors=32
;;
256)
echo "`date '+%b %e %T'`: Creating 256MB Compact Flash"
flash_MB=222
ramdisk_MB=64
boot_MB=8
zlog_MB=30
root_MB=$(( $flash_MB - $boot_MB - $zlog_MB ))
heads=16
sectors=32
#kernel_PARMS="idebus=100 ide=nodma ide0=0x177-0x177,0x376" #specific to LEX with CF on secondary master
#kernel_PARMS="" # Sis chipset workaround, don't use nodma
kernel_PARMS="ide=nodma" # Generic
grub_PARMS="--force-lba"
;;
512)
echo "`date '+%b %e %T'`: Creating 512MB Compact Flash"
flash_MB=485
ramdisk_MB=64
boot_MB=8
zlog_MB=30
root_MB=$(( $flash_MB - $boot_MB - $zlog_MB ))
heads=16
sectors=32
#kernel_PARMS="idebus=100 ide=nodma ide0=0x177-0x177,0x376" #specific to LEX with CF on secondary master
#kernel_PARMS="" # Sis chipset workaround, don't use nodma
kernel_PARMS="ide=nodma" # Generic
grub_PARMS="--force-lba"
;;
1gb)
echo "`date '+%b %e %T'`: Creating 1 Gigabyte Compact Flash"
flash_MB=978
ramdisk_MB=64
boot_MB=8
zlog_MB=30
root_MB=$(( $flash_MB - $boot_MB - $zlog_MB ))
heads=16
sectors=32
#kernel_PARMS="idebus=100 ide=nodma ide0=0x177-0x177,0x376" #specific to LEX with CF on secondary master
#kernel_PARMS="" # Sis chipset workaround, don't use nodma
kernel_PARMS="ide=nodma" Generic
grub_PARMS="--force-lba"
;;
*)
# echo "Usage: $0 {32|64|128|256|512|1gb} {hda|hdb|hdc|hdd}"
echo "Usage: $0 {128|256|512|1gb} {hda|hdb|hdc|hdd}"
exit 1
;;
esac
case "$CF" in
hda)
echo "`date '+%b %e %T'`: Creating hda Compact Flash"
drive_ID=hda4
;;
hdb)
echo "`date '+%b %e %T'`: Creating hdb Compact Flash"
drive_ID=hdb4
;;
hdc)
echo "`date '+%b %e %T'`: Creating hdc Compact Flash"
drive_ID=hdc4
;;
hdd)
echo "`date '+%b %e %T'`: Creating hdd Compact Flash"
drive_ID=hdd4
;;
*)
echo "Usage: $0 {32|64|128|256|512|1gb} {hda|hdb|hdc|hdd}"
exit 1
;;
esac
# Calculate all the required derived variables...
bs=512 # do not change!
flash_blocks=$(( $flash_MB * 1024 * 1024 / $bs ))
boot_blocks=$(( $boot_MB * 1024 * 1024 / $bs - 1 ))
zlog_blocks=$(( $zlog_MB * 1024 * 1024 / $bs ))
root_blocks=$(( $root_MB * 1024 * 1024 / $bs ))
boot_block_offset=1
zlog_block_offset=$(( $boot_block_offset + $boot_blocks ))
root_block_offset=$(( $zlog_block_offset + $zlog_blocks ))
boot_byte_offset=$(( $boot_block_offset * $bs ))
zlog_byte_offset=$(( $zlog_block_offset * $bs ))
root_byte_offset=$(( $root_block_offset * $bs ))
cylinders=$(( $flash_blocks / $heads / $sectors ))
# RAM Disk
ramdisk_KB=$(( $ramdisk_MB * 1024 ))
############################################################################
# #
# Loading loopback kernel module #
# #
############################################################################
echo "`date '+%b %e %T'`: Loading loopback kernel module"
modprobe loop
############################################################################
# #
# Creating empty flash image in /tmp/cf-image #
# #
############################################################################
echo "`date '+%b %e %T'`: Creating empty flash image in /tmp"
dd if=/dev/zero of=/tmp/flash.img bs=$bs count=$flash_blocks >/dev/null
dd if=/dev/zero of=/var/log/part1.img bs=$bs count=$boot_blocks >/dev/null
dd if=/dev/zero of=/var/log/part2.img bs=$bs count=$zlog_blocks >/dev/null
dd if=/dev/zero of=/var/log/part3.img bs=$bs count=$root_blocks >/dev/null
############################################################################
# #
# Making filesystems #
# #
############################################################################
echo "`date '+%b %e %T'`: Making filesystems"
mke2fs -F -j -m 0 -b 1024 /var/log/part1.img >/dev/null
mke2fs -F -j -m 0 -b 1024 /var/log/part2.img >/dev/null
mke2fs -F -j -m 0 -b 1024 /var/log/part3.img >/dev/null
############################################################################
# #
# Creating and partitioning Compact Flash image #
# #
############################################################################
echo "`date '+%b %e %T'`: Creating and partitioning Compact Flash image"
sfdisk -H $heads -S $sectors -C $cylinders -uM /tmp/flash.img <<EOF >/dev/null 2>&1
# Start Size Type Bootable
,$boot_MB,,* # /boot
,$zlog_MB,, # /var/log_compressed
,0,, # Unused
,$root_MB,, # /
EOF
dd if=/var/log/part1.img of=/tmp/flash.img seek=$boot_block_offset bs=$bs
dd if=/var/log/part2.img of=/tmp/flash.img seek=$zlog_block_offset bs=$bs
dd if=/var/log/part3.img of=/tmp/flash.img seek=$root_block_offset bs=$bs
rm -f /var/log/part?.img
############################################################################
# #
# Mounting loopback flash image under /mnt #
# #
############################################################################
echo "`date '+%b %e %T'`: Mounting loopback flash image under /mnt"
rm -rf /mnt/flash
mkdir -p /mnt/flash
mount -o loop,offset=$root_byte_offset /tmp/flash.img /mnt/flash
mkdir -p /mnt/flash/boot
mount -o loop,offset=$boot_byte_offset /tmp/flash.img /mnt/flash/boot
mkdir -p /mnt/flash/var/log_compressed
mount -o loop,offset=$zlog_byte_offset /tmp/flash.img /mnt/flash/var/log_compressed
############################################################################
# #
# Creating flash image directory structure #
# #
############################################################################
echo "`date '+%b %e %T'`: Creating flash image directory structure"
mkdir -p /mnt/flash/{ram/,proc/,mnt/}
############################################################################
# #
# Copying files into flash image #
# #
############################################################################
echo "`date '+%b %e %T'`: Copying files into flash image"
# /boot
cp -a /boot /mnt/flash/
# /var
mkdir -p /mnt/flash/var/{log,log_compressed,spool,www/icons}
cp -a /var/ipcop /var/lib /var/state /var/lock /var/log /mnt/flash/var
#######################################################################################
# Configure flash image ethernet settings #
# this allows you to stage on one system and build flash for LEX with 3 RTL8139 NIC's #
# if a settings file named settings.8139 is placed in your /root directory it will be #
# used to configure the flash image with the correct ethernet settings for the LEX #
# a default settings.8139 file is provided for your use #
#######################################################################################
if [ -f /root/settings.8139 ]
then
/bin/echo ""
/bin/echo "Configuring Flash With LEX RTL8139 Ethernet Settings"
/bin/echo ""
/bin/echo ""
cat /root/settings.8139 > /mnt/flash/var/ipcop/ethernet/settings
else
/bin/echo ""
/bin/echo "Flash Is Using Build System Ethernet Settings"
/bin/echo ""
/bin/echo ""
fi
rm -rf /mnt/flash/var/log/lost+found
cp -a /var/run /var/empty /mnt/flash/var
cp -a /var/spool/cron /mnt/flash/var/spool
ln -s /tmp /mnt/flash/var/patches
ln -sf /ram/squid /var/log/cache
rm -f /mnt/flash/var/lib/logrotate.status
rm -f /mnt/flash/var/state/dhcp/*
touch /mnt/flash/var/state/dhcp/dhcpd.leases
find /mnt/flash/var/run \( -type f -o -type s \) -exec rm -f {} \;
touch /mnt/flash/var/run/utmp
chmod 644 /mnt/flash/var/run/utmp
chown root:utmp /mnt/flash/var/run/utmp
touch /mnt/flash/var/log/wtmp
chmod 664 /mnt/flash/var/log/wtmp
chown root:utmp /mnt/flash/var/log/wtmp
# /var/log
rm -rf /mnt/flash/var/log/snort/*
find /mnt/flash/var/log -type f -exec rm -f {} \;
tar -C /mnt/flash -czf /mnt/flash/var/log_compressed/log.tgz var/log/
rm -rf /mnt/flash/var/log/
ln -sf /ram/log /mnt/flash/var/log
# Other files
cp -a /sbin /mnt/flash/
cp -a /bin /mnt/flash/
cp -a /lib /mnt/flash/
cp -a /dev /mnt/flash/
# create the symlinks
echo "`date '+%b %e %T'`: Creating $CF Sym Link"
ln -sf /dev/"$CF" /mnt/flash/dev/harddisk
echo "`date '+%b %e %T'`: Creating "$CF'1'" Sym Link"
ln -sf /dev/$CF'1' /mnt/flash/dev/harddisk1
echo "`date '+%b %e %T'`: Creating "$CF'2'" Sym Link"
ln -sf /dev/$CF'2' /mnt/flash/dev/harddisk2
echo "`date '+%b %e %T'`: Creating "$CF'3'" Sym Link"
ln -sf /dev/$CF'3' /mnt/flash/dev/harddisk3
echo "`date '+%b %e %T'`: Creating "$CF'4'" Sym Link"
ln -sf /dev/$CF'4' /mnt/flash/dev/harddisk4
cp -a /root /mnt/flash/
rm -f /mnt/flash/root/.bash_history
cp -a /etc /mnt/flash/
rm -rf /mnt/flash/etc/{httpd/conf/ssl*,makedev.d/}
rm -f /mnt/flash/etc/ssh/*key
rm -f /mnt/flash/etc/httpd/server.*
cp -a /home /mnt/flash/
rm -f /home/httpd/html/graphs/*
rm -f /home/httpd/html/sgraph/*
cp -a /usr /mnt/flash
rm -rf /mnt/flash/{tmp/,usr/tmp/,var/tmp/}
ln -sf /ram/tmp/ /mnt/flash/tmp
ln -sf /ram/tmp/ /mnt/flash/usr/tmp
ln -sf /ram/tmp/ /mnt/flash/var/tmp
ln -sf /dev/ram0 /mnt/flash/dev/ramdisk
############################################################################
# #
# Installing log backup cron job #
# #
############################################################################
echo "`date '+%b %e %T'`: Installing log backup cron job"
cat >> /mnt/flash/var/spool/cron/root.orig <<EOF
# Backup logs to flash
02 * * * * /etc/rc.d/rc.flash.down
EOF
chroot /mnt/flash /usr/bin/fcrontab -z >/dev/null 2>&1
############################################################################
# #
# Reconfiguring logrotate #
# #
############################################################################
echo "`date '+%b %e %T'`: Reconfiguring logrotate"
cp -pf logrotate.conf /mnt/flash/etc/
############################################################################
# #
# Installing new fstab #
# #
############################################################################
echo "`date '+%b %e %T'`: Installing new fstab"
cat /etc/fstab | sed -e 's/log\t/log_compressed/' > /mnt/flash/etc/fstab
df | grep /mnt/flash
############################################################################
# #
# Touching /etc/FLASH #
# #
############################################################################
echo "`date '+%b %e %T'`: Touching /etc/FLASH"
touch /mnt/flash/etc/FLASH
############################################################################
# #
# Create the Grub.conf file with our parameters #
# #
############################################################################
cat > /mnt/flash/boot/grub/grub.conf <<EOF
timeout 5
default saved
foreground = 16064e
background = ffffff
splashimage (hd0,0)/grub/ipcop.xpm.gz
title IPCop
root (hd0,0)
kernel /vmlinuz root=/dev/$drive_ID panic=10 acpi=off ro $kernel_PARMS ramdisk_size=$ramdisk_KB
savedefault
title IPCop SMP
root (hd0,0)
kernel /vmlinuz-smp root=/dev/$drive_ID panic=10 acpi=off ro $kernel_PARMS ramdisk_size=$ramdisk_KB
savedefault
title IPCop (ACPI enabled)
root (hd0,0)
kernel /vmlinuz root=/dev/$drive_ID panic=10 ro $kernel_PARMS ramdisk_size=$ramdisk_KB
savedefault
title IPCop SMP (ACPI HT enabled)
root (hd0,0)
kernel /vmlinuz-smp root=/dev/$drive_ID panic=10 acpi=ht ro $kernel_PARMS ramdisk_size=$ramdisk_KB
savedefault
EOF
############################################################################
# #
# Installing grub #
# #
############################################################################
echo "`date '+%b %e %T'`: Installing Grub"
/usr/sbin/grub --batch <<EOF >/dev/null 2>&1
device (hd0) /tmp/flash.img
geometry (hd0)
root (hd0,0)
makeactive
install $grub_PARMS (hd0,0)/grub/stage1 (hd0) (hd0,0)/grub/stage2 0x8000 p /grub/grub.conf
quit
EOF
############################################################################
# #
# Cleaning up #
# #
############################################################################
echo "`date '+%b %e %T'`: Cleaning up"
rm -f verinfo
umount /mnt/flash/var/log_compressed
umount /mnt/flash/boot
umount /mnt/flash
losetup -d /dev/loop0
losetup -d /dev/loop1
losetup -d /dev/loop2
mv /tmp/flash.img /tmp/$SIZE'flash.img'
echo "`date '+%b %e %T'`: Mkflash For $SIZE Flash Drive On $CF Complete"

View File

@@ -0,0 +1,30 @@
CONFIG_TYPE=3
GREEN_DRIVER=8139too
GREEN_DRIVER_OPTIONS=
GREEN_DEV=eth0
GREEN_DISPLAYDRIVER=8139too
GREEN_ADDRESS=192.168.1.254
GREEN_NETMASK=255.255.255.0
GREEN_NETADDRESS=192.168.1.0
GREEN_BROADCAST=192.168.1.255
ORANGE_DEV=eth1
RED_DEV=eth2
RED_DRIVER=8139too
RED_DRIVER_OPTIONS=
RED_DISPLAYDRIVER=8139too
ORANGE_DRIVER=8139too
ORANGE_DRIVER_OPTIONS=
ORANGE_DISPLAYDRIVER=8139too
ORANGE_ADDRESS=192.168.2.254
ORANGE_NETMASK=255.255.255.0
ORANGE_NETADDRESS=192.168.2.0
ORANGE_BROADCAST=192.168.2.255
RED_DHCP_HOSTNAME=ipcop
RED_ADDRESS=10.0.0.254
RED_NETMASK=255.255.255.0
RED_TYPE=STATIC
RED_NETADDRESS=10.0.0.0
RED_BROADCAST=10.0.0.255
DNS1=10.0.0.1
DNS2=10.0.0.1
DEFAULT_GATEWAY=10.0.0.1

84
tools/perfTest.sh Normal file
View File

@@ -0,0 +1,84 @@
#!/bin/bash
#
############################################################################
# #
# This file is part of the IPCop Firewall. #
# #
# IPCop 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. #
# #
# IPCop 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 IPCop; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
# Copyright (C) 2005 Mark Wormgoor <mark@wormgoor.com>. #
# #
############################################################################
#
# $Id: perfTest.sh,v 1.1.2.1 2005/01/26 19:43:36 riddles Exp $
#
# This script will do a get request for all links on an IPCop box.
# You can time this using:
# time ./perfTest.sh
#
# This will give you a basic idea of the speed of your IPCop machine
# and will make it possible for you to test new updates for performance.
# With just network overhead on a sufficiently fast machine, expect
# something around 5 seconds for the entire test.
#
## Basic settings
CGI_HOST=192.168.1.1
CGI_PORT=445
CGI_URL="https://$CGI_HOST:$CGI_PORT/cgi-bin"
USER=admin
PASS=password
CMD="wget -q -O /dev/null --http-user=$USER --http-passwd=$PASS"
doTest() {
$CMD $CGI_URL/aliases.cgi
$CMD $CGI_URL/backup.cgi
$CMD $CGI_URL/changepw.cgi
$CMD $CGI_URL/connections.cgi
$CMD $CGI_URL/credits.cgi
$CMD $CGI_URL/ddns.cgi
$CMD $CGI_URL/dhcp.cgi
$CMD $CGI_URL/dial.cgi
$CMD $CGI_URL/dmzholes.cgi
$CMD $CGI_URL/graphs.cgi
$CMD $CGI_URL/gui.cgi
$CMD $CGI_URL/hosts.cgi
$CMD $CGI_URL/ids.cgi
$CMD $CGI_URL/index.cgi
$CMD $CGI_URL/ipinfo.cgi
$CMD $CGI_URL/modem.cgi
$CMD $CGI_URL/netstatus.cgi
$CMD $CGI_URL/portfw.cgi
$CMD $CGI_URL/pppsetup.cgi
$CMD $CGI_URL/proxy.cgi
$CMD $CGI_URL/proxygraphs.cgi
$CMD $CGI_URL/remote.cgi
$CMD $CGI_URL/shaping.cgi
$CMD $CGI_URL/shutdown.cgi
$CMD $CGI_URL/status.cgi
$CMD $CGI_URL/time.cgi
$CMD $CGI_URL/updates.cgi
$CMD $CGI_URL/upload.cgi
$CMD $CGI_URL/vpnmain.cgi
$CMD $CGI_URL/wireless.cgi
$CMD $CGI_URL/xtaccess.cgi
$CMD $CGI_URL/logs.cgi/config.dat
$CMD $CGI_URL/logs.cgi/firewalllog.dat
$CMD $CGI_URL/logs.cgi/ids.dat
$CMD $CGI_URL/logs.cgi/log.dat
$CMD $CGI_URL/logs.cgi/proxylog.dat
$CMD $CGI_URL/logs.cgi/summary.dat
}
doTest