--- /dev/null
+#!/bin/bash
+
+# subroutines:
+configcp() {
+ file=$1
+ mkdir -p $configdir/$file
+ cp -v $file $configdir/$file/$myip
+}
+backupcp() {
+ cat=$1
+ object=$2
+ if [ "$cat" = "dir" ] ; then
+ rsync -av $object/ $backupdir/$object
+ elif [ "$cat" = "file" ] ; then
+ dir=`dirname $object`
+ rsync -av $object $backupdir/$dirname/
+ else
+ echo "warning: dont know how to handle $cat"
+ fi
+}
+
+# variables
+cserver="hermes" # configs which may be restored by fai
+rcdir="/mnt/extra/hdw-linux/fai/files"
+configdir="/mnt/tmp1"
+
+bserver="hermes" # data not usable for fai
+rbdir="/mnt/extra/backup"
+backupdir="/mnt/tmp2"
+
+# initializing custom variables
+host=`hostname`
+myip="`host $host | awk '{ print $4 }'`"
+res=$?
+if [ "$res" != "0" ] ; then
+ echo "unable to determine the hosts ip address"
+ exit 1
+fi
+answer=n
+echo "warning: the correct ip address is essential"
+echo "please make sure it is the correct one"
+echo "is the ip address correct? -> $myip [y/n]"
+read answer
+[ "$answer" != "y" ] && exit 1
+
+# mount backup and config space
+if [ -d $configdir -a -d $backupdir ] ; then
+ mount $cserver:$rcdir $configdir
+ res=$?
+ if [ "$res" != "0" ] ; then
+ echo "unable to mount configdir"
+ exit 1
+ fi
+ mount $bserver:$rbdir $backupdir
+ if [ "$res" != "0" ] ; then
+ echo "unable to mount backupdir"
+ exit 1
+ fi
+ res=$?
+ [ "$res" = "0" ] && b_mounted=1
+else
+ echo "$configdir or $backupdir (or both) doesn't exist"
+ exit 1
+fi
+
+# config:
+for configfile in /usr/src/kernel/*config; do
+ configcp $configfile
+done
+for onefile in profile network kernel wireless; do
+ configfile="/etc/conf/$onefile"
+ [ -f $configfile ] && configcp $configfile
+done
+for configfile in /etc/cron.d/* /var/spool/cron/crontabs/*; do
+ [ -f $configfile ] && configcp $configfile
+done
+for configfile in /etc/udev/rules.d/udev.rules /etc/X11/xorg.conf* \
+ /etc/opt/apache2/{httpd,ssl}.conf /etc/cups/cupsd.conf \
+ /etc/ppp/{pppoe.conf,ip-up,ip-down,pap-secrets} ; do
+ [ -f $configfile ] && configcp $configfile
+done
+for i in dhcpd.conf fstab hosts host.conf hosts.allow hosts.deny lilo.conf \
+ profile sendmail.cf resolv.conf exports fb.modes inetd.conf \
+ xinetd.conf mp3user mp3db.conf modules.conf named.conf \
+ modprobe.devfs modprobe.conf crontab ethers HOSTNAME; do
+ [ -f /etc/$i ] && configcp /etc/$i
+done
+for configfile in /var/named/*; do
+ [ -f $configfile ] && configcp $configfile
+done
+for configfile in /home/*/{xinitrc,.Xdefaults,.XHkeys,.directfbrc,.bashrc} \
+ /home/*/{.signature,sp12/*,.licq,.irssi,.ssh/*} ; do
+ [ -f $configfile ] && configcp $configfile
+done
+for configfile in `find /tftpboot -type f`; do
+ configcp $configfile
+done
+
+umount $configdir
+umount $backupdir
+
+echo "done ..."