#!/bin/sh

# $Header: /mit/linux/rh-6.2/RCS/linux-install-floppy,v 1.9 2001/05/09 21:59:25 cfox Exp $

IMAGEDIR=/mit/linux/rh-6.2
IMAGE=$IMAGEDIR/bootnet.img

case $ATHENA_SYS in
  sgi*)    FLOPPY=/dev/rdsk/fds0d2.3.5 ;;
  sun*)    volcheck ; FLOPPY=/vol/dev/aliases/floppy0 ;;
  *linux*) FLOPPY=/dev/fd0 ;;
  *nbsd*)  FLOPPY=/dev/fd0a ;;
  *)       echo "This is an unsupported system. Please use a" >&2;
	   echo "Sun, SGI, Linux or NetBSD Athena machine." >&2;
	   exit ;;
esac

# bsd or sysv style echo
TESTECHO=`echo -n`
case "$TESTECHO" in
   -n) N=''; C='\c';;
   *)  N='-n'; C='';;
esac


echo "Welcome to the SIPB linux installer..."
echo "Please print out a copy of the one-sheet guide to installing"
echo "from /mit/sipb/doc/rh-net-install.ps"
echo ""
echo "Most PC laptops require PCMCIA support in order to use their"
echo "network connection.  Is this the case for your machine?"
echo $N "(If you have a desktop, the answer is probably no.) [y/n] $C"

read pcmcia
if [ "$pcmcia" = "y" ]; then
IMAGE=$IMAGEDIR/pcmcia.img
fi

echo ""

dd if=$IMAGE of=$FLOPPY bs=18k conv=sync

if [ $? -eq 0 ]; then
  echo "Floppy written successfully.";
else
  cat >&2 <<EOF
Write failed. Make sure that your floppy disk is in the drive,
and that the disk is not write protected. If this continues to
fail, try another workstation or another floppy. If neither of
those solutions work, then try coming to the SIPB office, w20-557.
EOF
fi
