#!/bin/bash
#
#
# Define the MINIMUM version necessary to apply this driver
MINVER=64

# First check if the correct kernel version exists !
#
KVER=`uname -r | cut -d "." -f3`
if [ `expr $KVER` -lt $MINVER ] 
  then
    dialog --msgbox "Sorry must have at least kernel 1.1.64" 5 50
    exit
  else
    cat << EOF > /tmp/tmpmsg
            < Welcome to the Cyclom driver setup ! > 
              
v.0.2 (c) 1994 by Steffen R. Mueller (steffen@laguna.schiele-ct.de)

This little script will assist you in creating a new kernel 
with the cyclom driver included.
The setup procedure will optionally back up your current 
kernel source tree and will also offer a recovery routine
in case of trouble ! 8-)

In order to apply the Cyclom patches to your kernel you 
have to be root.
EOF
dialog --title "INSTALLING THE CYCLOM DRIVER" \
--menu "`cat /tmp/tmpmsg`" 22 75 4 \
"1" "Show me the HINTS file !" \
"2" "I'm careful and want to backup first ! DO A KERNEL BACKUP !" \
"3" "Let's do it ! APPLY ALL PATCHES !" \
"4" "Create the device files for me (/dev/cu?? and /dev/ttyC??)" \
                  2> /tmp/cdtype
if [ $? = 1 -o $? = 255 ]; then 
  rm -f /tmp/tmpmsg /tmp/cdtype
  exit
fi
SEL="`cat /tmp/cdtype`";rm -f /tmp/cdtype
if [ "$SEL" = "1" ]; then
  dialog --title "Cyclom driver HINTS" --textbox HINTS 18 76
  INST_CYCLOM
elif [ "$SEL" = "2" ]; then
  bck_kernel
elif [ "$SEL" = "3" ]; then
  do_it
elif [ "$SEL" = "4" ]; then
  make_special.sh 
fi
fi  
