:
#
# Copyright (C) The Santa Cruz Operation, 1988.
# This Module contains Proprietary Information of
# The Santa Cruz Operation, and Lachman Associates Inc.
# and should be treated as Confidential.
#
#
PATH=/bin:/usr/bin:/etc:/etc/conf/bin
LKPERM=/etc/perms/inst # OS (link kit) permlist
# Function Definitions
# Print an error message
# Usage: error "message"
# Argument is a quoted error message
error() {
echo "\nError: $*" >&2
return 1
}
#
# prompt the user to answer a yes no question or 'q' to quit
# Usage:
# prompt_yn "Message" default
prompt_yn() {
mesg=$1
default=$2
while :
do
echo "${mesg} (y/n) [${default}] : \c"
read result
case $result in
y|Y) result="Y"; return $OK;;
n|N) result="N"; return $OK;;
"") result=`echo $default | tr "yn" "YN"`; return $OK;;
esac
echo "Illegal value, please type 'y' or 'n'"
done
}
# Remove temp files and exit with the status passed as argument
cleanup() {
trap '' 1 2 3 15
rm -rf /tmp/backupfirst /tmp/perms /tmp/ID
exit $1
}
# Set release variable based on XENIX release.
chkrelease() {
if [ -f /etc/perms/rts ]
then
release=`grep rel= /etc/perms/rts | sed -e s/#rel=//`
val=`expr "3.2.1" ">" "$release"`
if [ "$val" = "1" ]
then
echo "LLI should not be installed in any releases prior to 3.2.1."
prompt_yn "Continue anyway?" y
[ "$result" = "N" ] && exit $FAIL
fi
fi
return $OK
}
# Test to see if link kit is installed
chklinkkit() {
# create five empty directories w/ fixperm for Phoenix Upgrade.
[ -f /tmp/system_upgrade ] && fixperm -c -d LINK $LKPERM >/dev/null 2>&1
until fixperm -i -d LINK $LKPERM 2> /dev/null
do case $? in
3|4) echo "The Link Kit is not installed." >&2
;;
5) echo "The Link Kit is only partially installed." >&2
echo " Continuing installation anyway." >&2
return 0
;;
*) echo "Error testing for Link Kit. Exiting."; cleanup 1 ;;
esac
# Not fully installed. Do so here
while echo "Do you wish to install it now? (y/n) \c"
do read ANSWER
case $ANSWER in
Y|y) custom -o -i LINK
break
;;
N|n) echo "Drivers cannot be installed without the Link Kit."
cleanup 1
;;
*) echo "Please answer 'y' or 'n'. \c"
;;
esac
done
done
}
# This routine checks to see if streams are currently configured in system
# files. It returns 0 if driver is sucessfully installed.
strchk () {
file=/etc/conf/sdevice.d/$1
[ -f $file ] && {
fieldval=`awk '{print $2}' $file` || {
error "awk failed to read $file."
cleanup 1
}
[ "$fieldval" = "N" ] && {
sed "s/N/Y/" $file > /tmp/sdevice.tmp || {
echo "Warning: unable to edit $file."
return 1
}
mv /tmp/sdevice.tmp $file
}
return 0
}
echo "Warning: /etc/conf/sdevice.d/$name does not exist."
return 1
}
chkstreams () {
streams_are="OK"
for name in "str" "clone" "log" "ptm" "pts" "ldterm" "ptem" "timod" \
"tirdwr" "sp"
do
strchk $name || streams_are="NOT_OK"
done
if [ "$streams_are" != "OK" ]
then
echo "Warning: Streams were not successfully added to the kernel"
echo " Continuing with installation of LLI drivers but they will not"
echo " work until the streams driver modules are installed"
fi
}
# main()
cd /
#
# Clean up and exit after signals
trap "cleanup 1" 1 2 3 15
# Check to see that we are not being installed on a UNIX release prior to 3.2.1
chkrelease
# Check to see that the link kit is installed,
# since drivers cannot be installed without it
chklinkkit
# Check for the presenceof STREAMS in the kernel,
# if they aren't there, install them
chkstreams
exit 0