+#!/bin/bash
+#
+# author: hackbard@hackdaworld.dyndns.org
+#
+# automated install rc_fai.sh script
+#
+
+root=/trg
+croot=/fai/config
+myip="`ifconfig eth0 | grep inet\ addr | awk '{ print $2 }' | awk -F: '{ print $2 }'`"
+myconf=$croot/$myip
+
+if [ ! -d $myconf ] ; then
+ echo "no config found, aborting fai"
+ exit
+fi
+
+disk=0
+disk=`grep '#\ disk' $myconf/disk | awk '{ print $3 }'`
+if [ ! -b $disk ] ; then
+ echo "disk $disk not found, aborting fai"
+ exit
+fi
+swap=0
+swap=`grep '#\ swap' $myconf/disk | awk '{ print $3 }'`
+if [ "$swap" != "0" -a -b ${disk}${swap} ] ; then
+ echo "creating swap device ..."
+ mkswap ${disk}${swap}
+ echo "done"
+fi
+
+cat $myconf/disk | grep -v '^#' | while read nr mp; do
+ if [ -b ${disk}${nr} ] ; then
+ echo "making filesystem for $mp"
+ mke2fs -j ${disk}${nr}
+ if [ "$mp" = "/" ] ; then
+ echo "mounting root partition"
+ mount ${disk}${nr} $root
+ fi
+ fi
+done
+
+cat $myconf/disk | grep -v '^#' | while read nr mp; do
+ if [ "$mp" != "/" ] ; then
+ if [ -b ${disk}${nr} ] ; then
+ mkdir -p $root/$mp
+ mount ${disk}${nr} $root/$mp
+ fi
+ fi
+done
+
+echo "to be continued ...."
+
+exit 0