#!/bin/sh


OS=`cat /proc/sys/kernel/osrelease`

echo $OS

if [ ! -s "$(find /lib/modules/$OS -type f -name doc.o -print|head -1)" ]; then

cat <<-EOF

$DEVPATH/doc.o not found, did you install it yet?

You need to do something like:

        ./patch_linux linux_2_2-patch driver-patch
        cd /usr/src/linux
        make menuconfig # select M-Systems DOC in  block device s
        make dep
        make modules
        make modules_install

EOF
exit
fi

MKINITRD=$(pwd)/_mkinitrd-v24
cd /boot
[ -s initrd-${OS}.img ] && rm initrd-${OS}.img
$MKINITRD --preload doc initrd-${OS}.img ${OS}

cd /etc

sed "/initrd=/d" < doc-lilo.conf | sed '/^image=/a\
        INITRD-HERE
' | sed "s;INITRD-HERE;initrd=/boot/initrd-${OS}.img;" > lilo.conf-initrd 

cp doc-lilo.conf lilo.conf-preinitrd

cat <<-EOF

The initrd file has been created in:

        /boot/initrd-${OS}.img

We have put a modified copy of your doc-lilo.conf in:

        /etc/lilo.conf-initrd


You should verify that it is correct and install with:

        doc-lilo -v -C /etc/lilo.conf-initrd

Then reboot to test.

EOF

