Paketmanagement umgeschrieben, GPG-Signatur jetzt moeglich.

Noch im Teststadium - Clamav ist das Testpaket.
Fixes in den neuen Statusseiten und Proxysteuerung.
Mkflash-Scripte entfernt. (Frag mich wozu die da ueberhaupt waren...)


git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@511 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2007-05-01 20:23:13 +00:00
parent d56fc335c7
commit 0d909a4a5e
12 changed files with 112 additions and 651 deletions

View File

@@ -19,6 +19,7 @@ $|=1; # line buffering
$Header::revision = 'final';
$Header::swroot = '/var/ipfire';
$Header::graphdir='/srv/web/ipfire/html/graphs';
$Header::pagecolour = '#ffffff';
#$Header::tablecolour = '#a0a0a0';
$Header::tablecolour = '#FFFFFF';

View File

@@ -0,0 +1,29 @@
#usr/bin/clamav-config
usr/bin/clamconf
usr/bin/clamdscan
usr/bin/clamscan
usr/bin/freshclam
usr/bin/sigtool
#usr/include/clamav.h
#usr/lib/libclamav.a
#usr/lib/libclamav.la
usr/lib/libclamav.so
usr/lib/libclamav.so.1
usr/lib/libclamav.so.1.0.40
#usr/lib/pkgconfig/libclamav.pc
usr/sbin/clamd
#usr/share/clamav
usr/share/clamav/daily.cvd
usr/share/clamav/main.cvd
#usr/share/man/man1/clamconf.1
#usr/share/man/man1/clamdscan.1
#usr/share/man/man1/clamscan.1
#usr/share/man/man1/freshclam.1
#usr/share/man/man1/sigtool.1
#usr/share/man/man5/clamd.conf.5
#usr/share/man/man5/freshclam.conf.5
#usr/share/man/man8/clamav-milter.8
#usr/share/man/man8/clamd.8
#var/ipfire/clamav
var/ipfire/clamav/clamd.conf
var/ipfire/clamav/freshclam.conf

65
make.sh
View File

@@ -609,14 +609,14 @@ buildpackages() {
ipfiremake pxe
mv $LFS/install/images/{*.iso,*.tgz,*.img.gz} $BASEDIR >> $LOGFILE 2>&1
# ipfirepackages
ipfirepackages
# Cleanup
stdumount
rm -rf $BASEDIR/build/tmp/*
# Generating total list of files
echo "Generating files list from logs" | tee -a $LOGFILE
echo -n "Generating files list from logs" | tee -a $LOGFILE
rm -f $BASEDIR/log/FILES
for i in `ls -1tr $BASEDIR/log/[^_]*`; do
if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
@@ -626,51 +626,29 @@ buildpackages() {
cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES
fi
done
cd $BASEDIR/packages; ls -w1 *.ipfire | awk -F ".ipfire" '{ print $1 }' > $BASEDIR/packages/packages_list.txt
echo -n "###EOF###" >> $BASEDIR/packages/packages_list.txt
beautify message DONE
cd $PWD
}
ipfirepackages() {
if [ -d "$BASEDIR/packages" ]; then
for i in `ls $BASEDIR/packages`; do
touch $BASEDIR/build/install/packages/$i.empty
done
fi
# ipfiredist amavisd
ipfiredist applejuice
ipfiredist asterisk
# ipfiredist applejuice
# ipfiredist asterisk
ipfiredist clamav
ipfiredist cups
ipfiredist cyrusimap
ipfiredist fetchmail
ipfiredist ffmpeg
ipfiredist gnump3d
ipfiredist iptraf
ipfiredist java
ipfiredist lame
ipfiredist libmad
ipfiredist libogg
ipfiredist libvorbis
ipfiredist mailx
ipfiredist mldonkey
ipfiredist mpeg2dec
ipfiredist nagios
ipfiredist nfs
ipfiredist nmap
ipfiredist ntop
ipfiredist portmap
ipfiredist postfix
ipfiredist procmail
ipfiredist samba
ipfiredist sox
ipfiredist spamassassin
ipfiredist subversion
ipfiredist videolan
ipfiredist webcyradm
ipfiredist xvid
ipfiredist yasuc
# ipfiredist cups
# ipfiredist cyrusimap
# ipfiredist fetchmail
# ipfiredist gnump3d
# ipfiredist java
# ipfiredist mailx
# ipfiredist mldonkey
# ipfiredist nfs
# ipfiredist postfix
# ipfiredist samba
# ipfiredist sox
# ipfiredist spamassassin
# ipfiredist webcyradm
test -d $BASEDIR/packages || mkdir $BASEDIR/packages
mv -f $LFS/install/packages/*.{ipfire,md5} $BASEDIR/packages >> $LOGFILE 2>&1
rm -rf $BASEDIR/build/install/packages/*
@@ -1062,6 +1040,13 @@ pxe)
lang)
update_langs
;;
packages)
case "$2" in
sign)
sign_packages
;;
esac
;;
"")
clear
svn info

View File

@@ -33,7 +33,8 @@ int main(int argc, char *argv[]) {
safe_system("/etc/rc.d/init.d/squid flush");
} else if (strcmp(argv[1], "enable") == 0) {
safe_system("ln -fs ../init.d/squid /etc/rc.d/rc3.d/S99squid >/dev/null 2>&1");
safe_system("ln -fs ../init.d/squid /etc/rc.d/rc{0,6}.d/K00squid >/dev/null 2>&1");
safe_system("ln -fs ../init.d/squid /etc/rc.d/rc0.d/K00squid >/dev/null 2>&1");
safe_system("ln -fs ../init.d/squid /etc/rc.d/rc6.d/K00squid >/dev/null 2>&1");
} else if (strcmp(argv[1], "disable") == 0) {
safe_system("rm -f /etc/rc.d/rc*.d/*squid >/dev/null 2>&1");
} else {

View File

View File

View File

View File

@@ -5,31 +5,22 @@ VER="$2"
PAK_VER="$3"
EXT=ipfire
if [ -f /install/packages/$PROG-$VER-$PAK_VER.tar.gz.empty ]; then
echo -e "Package already exists."
else
# Bringing the files to their right place.
rm -rf /install/packages/package /tmp/* /packagetmp.tar
mkdir -p /install/packages/package
mkdir -p /install/packages/package
cp -f /usr/src/src/paks/$PROG/{,un}install.sh /install/packages/package
cp -f /usr/src/src/paks/$PROG/ROOTFILES /install/packages/package
cp -f /usr/src/src/paks/$PROG/depends.txt /install/packages/package
cp -f /usr/src/src/paks/$PROG/update.sh /install/packages/package
cp -f /usr/src/config/rootfiles/packages/$PROG /install/packages/package/ROOTFILES
chmod 755 /install/packages/package/{,un}install.sh
cd / && tar --create --directory=/ --files-from=/install/packages/package/ROOTFILES --file=/packagetmp.tar --exclude='#*'
cd / && tar -x -C /tmp -f /packagetmp.tar
rm -f /packagetmp.tar
cd /tmp && tar --create --gzip --verbose --file=/install/packages/package/files.tgz *
cd /tmp && tar --create --bzip2 --verbose --file=/install/packages/package/files.tbz2 *
cd / && rm -rf /tmp/*
cd /install/packages/package && cat ROOTFILES | grep -v "#" > ROOTFILES
tar cfz ../$PROG-${VER}_$PAK_VER.$EXT files.tgz install.sh uninstall.sh ROOTFILES depends.txt
cd /install/packages && md5sum $PROG*.$EXT > $PROG-${VER}_$PAK_VER.$EXT.md5
cd /install/packages && md5sum $PROG*.$EXT >> all-progs.md5
tar cfj ../$PROG-${VER}_$PAK_VER.$EXT files.tbz2 install.sh uninstall.sh update.sh ROOTFILES
rm -rf /install/packages/package
exit 0
fi

View File

@@ -395,25 +395,31 @@ ipfiremake() {
}
ipfiredist() {
if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then
echo "`date -u '+%b %e %T'`: Packaging $1" | tee -a $LOGFILE
chroot $LFS /tools/bin/env -i HOME=/root \
TERM=$TERM PS1='\u:\w\$ ' \
PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
VERSION=$VERSION \
CONFIG_ROOT=$CONFIG_ROOT \
NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
KVER=$KVER IPFVER="$IPFVER" \
BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
/bin/bash -x -c "cd /usr/src/lfs && \
make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
if [ $? -ne 0 ]; then
exiterror "Packaging $1"
fi
lfsmakecommoncheck $*
[ $? == 1 ] && return 0
local PKG_TIME_START=`date +%s`
chroot $LFS /tools/bin/env -i HOME=/root \
TERM=$TERM PS1='\u:\w\$ ' \
PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
VERSION=$VERSION \
CONFIG_ROOT=$CONFIG_ROOT \
NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \
KVER=$KVER IPFVER="$IPFVER" \
BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \
/bin/bash -x -c "cd /usr/src/lfs && \
make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
local COMPILE_SUCCESS=$?
local PKG_TIME_END=`date +%s`
if [ $COMPILE_SUCCESS -ne 0 ]; then
beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
exiterror "Packaging $*";
else
exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"
beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
fi
return 0
}
@@ -480,9 +486,9 @@ batch_script() {
$0 upload iso
evaluate 1 mail_me ISO
# echo -ne "### UPLOADING PAKS"
# $0 upload paks
# evaluate 1 mail_me PAKS
echo -ne "### UPLOADING PAKS"
$0 upload paks
evaluate 1 mail_me PAKS
echo -ne "${BOLD}***SUCCESS!${NORMAL}"
mail_me success
@@ -703,3 +709,25 @@ update_langs() {
$BASEDIR/tools/check_langs.sh > $BASEDIR/doc/language_missings
beautify message DONE
}
sign_packages() {
if gpg --list-key 64D96617 ; then
if [ -d "$BASEDIR/packages" ]; then
cd $BASEDIR/packages
for i in `ls $BASEDIR/packages`; do
echo -n "Signing $i"
echo $GPG_PASSPHRASE | gpg --sign --armor -u 64D96617 --passphrase-fd 0 $i
if [ "$?" -eq "0" ]; then
beautify message DONE
mv -f $i.asc $i
else
beautify message FAIL
fi
done
cd -
fi
else
echo -n "You don't have the secret key to sign ipfire's packages!"
beautify message FAIL
fi
}

View File

@@ -1,84 +0,0 @@
# 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
}

View File

@@ -1,460 +0,0 @@
#!/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

@@ -1,30 +0,0 @@
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