#! /bin/sh
#
# Granada Microcare Helpdesk
#
# mkkernel... A shell script for creating a bootable 
# kernel on a floppy

ERRFILE=/tmp/$$_TMP

cat << INTRO
                       -- mkkernel --

 > This script creates a bootable kernel disk. Insert floppy disc 
 > and press Return when ready...................
 >
 >        ( Type any character key/s and Return to abort )

INTRO

read STRING
echo
if [ ${STRING}X != "X" ]
then
     echo; echo $0 aborted; echo
     exit 1
fi

# Only Return has been pressed so go ahead and make the kernel disk

echo; echo " > Formatting floppy....." ; echo
ffd 
echo
newfs -b 8192 -c 32 -m 0 -o space -r 1 -i 65536 /dev/fdf1024 fdf1024
mount /dev/fdf1024 /mnt > $ERRFILE 2>&1 

# Check for errors during mount.....
if [ -s $ERRFILE ]
then
     echo; echo " > Error mounting floppy"; echo;
     cat $ERRFILE
     rm $ERRFILE
     exit 1
fi

#And install the kernel

echo; echo " > Copying the kernel ( /vmunix ) to the floppy....."
cp /vmunix /mnt

echo; echo " > Copying a compressed V1.13 shared library ( if it exists )....."
compress -c /lib/c:8904121930.16 > /mnt/c:8904121930.16.Z

echo; echo " > Copying some other compressed files....."
compress -c /usr/acorn/dsplit > /mnt/dsplit.Z

umount /mnt

cat << FINISHED

 > Kernel disk successfully created. Note that in future this
 > disk will be referred to as the 'Kernel disk' and you may 
 > wish to label it accordingly........

FINISHED

#      ================= END OF SCRIPT =====================
