# This program modifys a standard version of Smoothwall V3.0 Polar# to use a Compact Flash adaptor instead of a hard disk.## It is distributed under GPL V3.0 license which should be present.# I have no concerns with anybody doing what they like with this but# want to ensure that everybody benefits from this work.

# Do not change this unless you know exactly what you are doing.# I wrote the code and I don't know what I'm doing so take that as a hint!my $testmode=0;

# Variables that the user can change.# How much information is printed from running lilo. Useful for debugging things.my $lilodebuglevel = 1;

# What percentage of RAM should be reserved for a ram disk. 10 = 10% 50 = 50%. 10%# is fine for 128MB of RAM, 25% should be ok for 512MB, 50% should be ok for 1GB.# Note that you can never have a ramdisk size bigger than the swap disk size.my $ramdiskpercentage = 10;

This program automatically modifies relevant files so thatyou can boot off and use a Compact Flash based hard disk adaptor.

It only runs on a standard install of Smoothwall V3.0 Express Polar. It *may*work on later versions but at the moment it is only tested on this version. Ifyou have modified Smoothwall this may not work at all. You have been warned!

No guarantees whatsover are made for the use of this program.

1) Install the modifications. The program checks to see if it has been run already and if so, will not run again.

After each update, use this function to check whether the files needed for the CF mod have changed.

9) Uninstall and return to the previous state. If you have edited any of the files this installer uses the complete uninstall will fail.

Choose an option:

1) Install Check installation9) Uninstall";

# This mod makes a ramdisk for use with /var/log.# We cannot (easily) use /var to mount as /var is a bigger directory in V3 than in V2.# We would have to syncronise very carefully to ensure we didn't lose anything.

# Check to see if all the directory system in /var/log looks OK. Create directories if needed but echo the errorfor i in /var/log/httpd /var/log/snort /var/log/imspector /var/log/squiddo if [ ! -d \$i ]; then echo \"Directory \$i does not exist. Creating it\" mkdir -p \$i fidone

# Copy the weekly logroatate function to do daily. /mnt/log is so much smaller now we have # to be radical with logs. `cp /etc/cron.weekly/logrotate /etc/cron.daily/logrotate`;

return WriteOutputFile("$outputdir$dir" , $file , @lines);}

sub DoInstall { my $file; # Check to see if this is the first time we have run this. We only run this once! Exit(1 , "We've already made the modifications to this machine. No point in running again\n") if (-d "$backupdir");

my %checksum; # The order we do this in is important. Modify_lilo.conf needs to be first. $file = "/etc/lilo.conf"; $checksum{"$file"} = Modify_liloconf($outputdir , "$ROOT_DIR/$file"); Exit("Can't modify '$file'. No files have been changed. Exiting\n") if ($checksum{$file} eq "");

# Write out the md5sums of the files we have changed. If we want to uninstall then we need to check # that the files have been untouched with human hands. we check the md5sums of the files against this # to see they are OK. open(OUT , ">$backupdir/md5sums") || Exit(1 , "Can't open $backupdir/md5sums for writing\n"); for $file (keys %checksum) { print OUT "$file ".$checksum{$file}."\n"; } close(OUT);

# Check to see if we have all the backed up files OK. for $file (@restorefiles) { Log "Checking $backupdir$file\n"; Exit(1 , "Can't find backup file $backupdir$file\n") if (! -f "$backupdir$file"); }

if ($count == $totalcount) { Log "All the files modified by the Compact Flash modification are untouched.\n"; Log "\nThis means there is no need to install this modification as nothing\n"; Log "has changed.\n\n"; Log "\nYou are advised NOT to try and reinstall\n";