#!/bin/sh
# $Id: 5.patchfiles.sh,v 1.23 2004/10/15 01:38:23 saturnero Exp $
 
set -e -u

. ./config.sh
. ./.common.sh

FILES="rc rc.live rc.conf rc.shutdown fstab rc.local"

echo "Patching files in /etc directory..."
cp $LOCALDIR/files/rc.conf.5 $FREESBIEBASEDIR/etc/rc.conf || print_error
cp $LOCALDIR/files/freesbie_1st $FREESBIEBASEDIR/etc/rc.d/freesbie_1st || print_error
mkdir -p $FREESBIEBASEDIR/usr/local/etc/rc.d || print_error
touch $FREESBIEBASEDIR/etc/fstab || print_error
cp $LOCALDIR/files/rc.local.5 $FREESBIEBASEDIR/etc/rc.local || print_error

cp $LOCALDIR/files/motd         $FREESBIEBASEDIR/etc || print_error
cp $LOCALDIR/files/hosts        $FREESBIEBASEDIR/etc || print_error
cp $LOCALDIR/files/loader.conf  $FREESBIEBASEDIR/boot || print_error

echo "Copying FloppyBackup and cardDetect scripts"

mkdir -p $FREESBIEBASEDIR/scripts/ || print_error
cd $LOCALDIR/files/scripts/ || print_error
for i in `find . -type d -not -name 'CVS' -maxdepth 1`
do
	mkdir -p $FREESBIEBASEDIR/scripts/$i || print_error
	for j in `find $i -type f -maxdepth 1`
	do
		cp -p $j $FREESBIEBASEDIR/scripts/$j || print_error
	done
done
