#
# Orchid Designer VGA Driver Install Script
#	Paul W. Carlson		Nov. 1988
#
TMP=/tmp/vio.err
ERROR1=" Errors have been written to the file $TMP."
ERROR2=" The Orchid Designer VGA Driver software was not installed.
Call Paul Carlson, FTS 832-6795, if you need more information."
echo
echo
echo
echo
echo "                 Installing Orchid Designer VGA Device Driver"
echo "                                Version 1.08"
echo "                    Author: Paul W. Carlson   FTS 832-6795"
echo
echo

# Check if driver is already installed
/etc/conf/bin/idcheck -p vio 2>$TMP
if [ $? != 0 ]
then
    /etc/conf/bin/idinstall -d vio
fi

# Make sure video memory is free by setting the last two fields
# to 0 for the kd entries in the files /etc/conf.cf.d.sdevice and
# /etc/conf/sdevice.d/kd.   Ron Glenn  7/90
cat /etc/conf/cf.d/sdevice | awk '{
if ($1 == "kd") 
      { $9 = "0";
	$10 = "0";
	printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",$1,$2,$3,$4,$5,$6,$7,$8,$9,$10);}
if ($1 != "kd") print $0
}' > tmp
mv tmp /etc/conf/cf.d/sdevice
cat /etc/conf/sdevice.d/kd | awk '{
if ($1 == "kd") 
      { $9 = "0";
	$10 = "0";
	printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",$1,$2,$3,$4,$5,$6,$7,$8,$9,$10);}
if ($1 != "kd") print $0
}' > tmp
mv tmp /etc/conf/sdevice.d/kd

# Now try to install the driver
/etc/conf/bin/idinstall -a vio 2>>$TMP
if [ $? != 0 ]
then
    message "There was an error during package installation. $ERROR1 $ERROR2"
    exit 1
fi

# Rebuild the kernel
/etc/conf/bin/idbuild 2>>$TMP
if [ $? != 0 ]
then
    /etc/conf/bin/idinstall -d vio
    message "There was an error during Kernel reconfiguration. $ERROR1 $ERROR2"
    exit 1
fi

rm -f $TMP
echo
echo "Installation of the Orchid Designer VGA Device Driver is complete."
echo
exit 0
