:
# (C) 1989-1990 The Santa Cruz Operation, Inc. All Rights
# Reserved. The user has unlimited right to use, modify
# and incorporate this code into other products provided
# it is used with SCO products and the user includes
# this notice and the associated copyright notices with
# any such application.
#
# This script is for use on machines without netconfig. When the user types
# mkdev 'board' (eg mkdev e3B) then this script will execute the appropriate
# netconfig script to configure the board.
#
NETCONF=/usr/lib/netconfig
CONF=/etc/conf
PATH=/bin:/usr/bin:/etc/:$CONF/bin:$LIB
MAX_BDS=2
OK=0; FAIL=1; RELINK=2;
getyn() {
while echo "$* (y/n/q) \c">&2
do read yn rest
case $yn in
[yY]) return 0 ;;
[nN]|[qQ]) return 1 ;;
*) echo "Please answer y, n, or q" >&2 ;;
esac
done
}
ask_installing() {
drv=$1
while echo "Add, remove, or modify the $drv driver or q to quit (a/r/m/q) : \c">&2
do read yn rest
case $yn in
[aA]) inst_or_remv="install"
break
;;
[rR]) inst_or_remv="remove"
break
;;
[mM]) inst_or_remv="modify"
break
;;
[qQ]) exit $OK ;;
*) echo "Please answer 'a', 'r', or 'm'" >&2 ;;
esac
done
}
cleanup() {
rm -f /tmp/${base}${i}.src
exit $1
}
# main()
#
if [ $# = 0 ]
then
base=`basename $0`
else
base=$1
fi
/etc/lliconfig
relink="N"
first_board="Y"
ask_installing $base
cd $NETCONF/info
if [ "$inst_or_remv" = "remove" ]
then
i=3
else
i=0
fi
while [ $i -ge 0 -a $i -lt $MAX_BDS ]
do
bd=`ls ${base}${i} 2>/dev/null`
if [ "$inst_or_remv" = "install" ]
then
script=$NETCONF/init/$bd
elif [ "$inst_or_remv" = "modify" ]
then
script=$NETCONF/reconf/$bd
else
script=$NETCONF/remove/$bd
fi
if [ ! -f $script ]
then
if [ "$inst_or_remv" != "remove" ]
then
break
elif [ $i != "0" ]
then
i=`expr $i - 1`
continue
else
break
fi
fi
if [ "$first_board" = "N" -a "$inst_or_remv" = "install" ]
then
echo
getyn "Do you have another $base board to $inst_or_remv?" || break
fi
first_board="N"
if [ "$inst_or_remv" = "modify" ]
then
do_modify=N
currdir=`pwd`
cd /etc/conf/sdevice.d
CARDS=`ls -C ${base}[0-3]`
echo "Driver list: ${CARDS}"
for card in $CARDS
do
check=`awk '{ print $2 }' < $card`
if [ "$check" = "Y" ]
then
getyn "\tModify $card configuration?" && {
script=$NETCONF/reconf/$card
do_modify=Y
break
}
[ $yn = "q" -o $yn = "Q" ] && break
else
echo "${card} not currently installed in kernel"
fi
done
cd $currdir
[ $do_modify = "Y" ] || exit $OK
fi
# Execute the netconfig script
$script - - mkdev lli y
ret=$?
if [ $ret = $FAIL ]
then
cleanup $FAIL
elif [ $ret = $RELINK ]
then
relink="Y"
fi
rm -f /tmp/${base}${i}.src
if [ "$inst_or_remv" = "install" ]
then
i=`expr $i + 1`
else
i=`expr $i - 1`
fi
done
if [ "$relink" = "Y" ]
then
echo
getyn "Relink the kernel now?" || exit $OK
cd /etc/conf/cf.d
./link_unix
fi