exit
fi
+echo "debug:"
+route
+ifconfig
+
+#
+# we need writeable /tmp
+#
+mount -tramfs ramfs /tmp
+
+#
+# check if disk is ready
+#
+if [ ! -f $myconf/disk_ready ] ; then
+ echo
+ echo "you're disk seems to not be ready. login now and use cfdisk"
+ echo "to partition your harddisk. please make sure it's compatible"
+ echo "to $myconf/disk:"
+ cat $myconf/disk
+ echo
+ echo "after partitioning your harddisk please touch the file"
+ echo "$myconf/disk_ready"
+ echo "on your fai install server and reboot."
+ echo "... fully automated, he? :p"
+ echo
+ exit
+fi
+
+#
+# disk
+#
disk=0
disk=`grep '#\ disk' $myconf/disk | awk '{ print $3 }'`
if [ ! -b $disk ] ; then
mkswap ${disk}${swap}
echo "done"
fi
-
-cat $myconf/disk | grep -v '^#' | while read nr mp; do
+cat $myconf/disk | grep -v '^#' | while read nr mp fs ac; do
if [ -b ${disk}${nr} ] ; then
- echo "making filesystem for $mp"
- mke2fs -j ${disk}${nr}
+ action=""
+ [ "$fs" = "ext3" ] && action="mke2fs -j"
+ [ "$fs" = "ext2" ] && action="mke2fs"
+ if [ "$ac" = "format" -a -n "$action" ] ; then
+ echo "making filesystem for $mp"
+ $action ${disk}${nr}
+ fi
if [ "$mp" = "/" ] ; then
echo "mounting root partition"
mount ${disk}${nr} $root
+ mkdir -p $root/etc
+ grep -v '/dev/root' /etc/fstab > $root/etc/fstab
+ echo -e "${disk}${nr}\t$mp\t$fs\tdefaults 0 2" >> \
+ $root/etc/fstab
fi
fi
done
-
-cat $myconf/disk | grep -v '^#' | while read nr mp; do
+cat $myconf/disk | grep -v '^#' | while read nr mp fs ac; do
if [ "$mp" != "/" ] ; then
if [ -b ${disk}${nr} ] ; then
mkdir -p $root/$mp
mount ${disk}${nr} $root/$mp
+ echo -e "${disk}${nr}\t$mp\t$fs\tdefaults 0 2" >> \
+ $root/etc/fstab
fi
fi
done
+[ "$swap" != "0" -a -b ${disk}${swap} ] && \
+ echo -e "${disk}${swap}\tswap\tswap\tdefaults 0 0" >> $root/etc/fstab
+# packages might install new fstab file, stored.
+cp $root/etc/fstab $root/etc/fstab~
+
+#
+# install packages
+#
+cd /tmp # we need to wget stuff!
+pkglist=""
+[ -f $myconf/packages ] && pkglist=$myconf/packages
+if [ -z "$pkglist" ] ; then
+ echo "cant find package list for $myip, aborting"
+ exit
+fi
+hdw-get dist-install $root $pkglist
+
+#
+# config / files
+#
+cp $root/etc/fstab~ $root/etc/fstab
+cp /etc/hdw-get.conf $root/etc
+# files
+cd /fai/files
+for file in `find -type f | grep -v CVS`; do
+ srcf=`basename $file`
+ trgf=`dirname $file`
+ [ "$srcf" = "DEFAULT" -o "$srcf" = "$myip" ] && cp -v $file $root/$trgf
+done
+
+#
+# essential device file
+#
+[ ! -c $root/dev/null ] && mknod -m 0666 $root/dev/null c 1 3
+[ ! -c $root/dev/console ] && mknod -m 0600 $root/dev/console c 5 1
+
+
+#
+# lilo
+#
+proot=${disk}`grep /[^a-z,^A-Z] $myconf/disk | awk '{ print $1 }'`
+echo "running lilo -> root device = $proot"
+cat > $root/etc/lilo.conf << EOF
+boot=$disk
+prompt
+lba32
+timeout=30
+
+default=vmlinuz_hdw
+
+image=/boot/vmlinuz_hdw
+ label=vmlinuz_hdw
+ append="root=$proot"
+ read-only
+
+EOF
+# run lilo in chroot
+cat > $root/run_lilo.sh << EOF
+mount /dev
+mount /sys
+mount /proc
+mkdir -p /dev/shm && mount /dev/shm
+mkdir -p /dev/pts && mount /dev/pts
+udevstart
+ln -s /proc/self/fd /dev/fd
+ln -s /proc/self/fd/0 /dev/stdin
+ln -s /proc/self/fd/1 /dev/stdout
+ln -s /proc/self/fd/2 /dev/stderr
+ln -s /proc/kcore /dev/core
+lilo
+EOF
+chmod 755 $root/run_lilo.sh
+chroot $root /usr/bin/env PATH="/bin:/usr/bin:/sbin:/usr/sbin" /bin/bash \
+ --login +h /run_lilo.sh
+
+echo
+echo "fai finished, good luck for reboot ... :)"
+echo
-echo "to be continued ...."
+touch /tmp/fai_finished
exit 0