#!/bin/ash
#
#
 ROOTFS=$(cat /etc/rootfs)
 if [ ! $ROOTFS = /dev/ram0 ]; then
   exit
 fi
 clear
 echo Seeking...
 mount /dev/cdrom 2>/dev/null
 INITRD=none
 if [ -e /media/cdrom/boot/initrd.gz ]; then
   INITRD=/media/cdrom/boot/initrd.gz
   else
   mountall
   cd /media/disk
   find -name initrd.gz | cut -c 2- > /tmp/INITRD.TMP
   if [ -s /tmp/INITRD.TMP ]; then
     INITRD=/media/disk$(cat /tmp/INITRD.TMP)
   fi
 fi
 if [ $INITRD = none ]; then
   if [ ! -e /tmp/retry.tmp ]; then
     touch /tmp/retry.tmp
     uevent mdev & mdev -s
     exec installer
     else
     echo "ERROR:"
     echo "Installation CD (or USB) not found."
     echo "Execute 'installer' to retry."
     exit
   fi
 fi
 . /usr/sbin/install2hd
 clear
 mount /dev/$TARGET /mnt/$TARGET
 echo "Unpacking files. Please wait..."
 sleep 1
 ln -s $INITRD /mnt/$TARGET
 cd /mnt/$TARGET
 cp etc/lilo.conf lilo.conf
 cp etc/init.d/rcS rcS
 gzip -cd initrd.gz | cpio -iduv
 rm initrd.gz
 rm etc/* 2>/dev/null
 cp /etc/inittab etc
 mv lilo.conf etc
 mv rcS etc/init.d
 cd && umount /dev/$TARGET
 echo Done!
