home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 4 Drivers
/
04-Drivers.zip
/
viabus.zip
/
580_238.EXE
/
arj
/
UNIX
/
VIAIDE.TAR
/
tmp
/
init.via
Wrap
Text File
|
1997-08-26
|
5KB
|
272 lines
: ${OK=0} ${FAIL=1} ${STOP=10}
VER=`uname -r`
OSVER=`swconfig|awk -e '/SCO UNIX System V Operating Sys/ {print $7}'`
HD_SPACE=/etc/conf/pack.d/hd/space.c
LINKPKG=/etc/perms/inst
Wd_Sdevice=/etc/conf/sdevice.d/wd
Wd0_Sdevice=/etc/conf/sdevice.d/wd0
Wd1_Sdevice=/etc/conf/sdevice.d/wd1
Tmp_Wd=/tmp/tmpwd
Tmp_Wd0=/tmp/tmpwd0
Tmp_Wd1=/tmp/tmpwd1
CONF=/etc/conf/cf.d
PRODUCT="VIA Bus Master PCI IDE Device Driver"
# Check whether the linkpkg exists.
linkpkg_check()
{
if [ ! -f $LINKPKG ] ; then
echo "Please install the LINK PACKAGE first.\n"
exit $FAIL
fi
}
#Mask Default IDE Card
mask_default_ide()
{
grep Y $Wd_Sdevice > /dev/null 2>&1
if [ $? -eq 0 ] ; then
sed "s/Y/N/" $Wd_Sdevice > $Tmp_Wd || {
echo "Enable to modify the $Wd_Sdevice\n"
return $FAIL
}
fi
grep Y $Wd0_Sdevice > /dev/null 2>&1
if [ $? -eq 0 ] ; then
sed "s/Y/N/" $Wd0_Sdevice > $Tmp_Wd0 || {
echo "Enable to modify the $Wd0_Sdevice\n"
return $FAIL
}
fi
grep Y $Wd1_Sdevice > /dev/null 2>&1
if [ $? -eq 0 ] ; then
sed "s/Y/N/" $Wd1_Sdevice > $Tmp_Wd1 || {
echo "Enable to modify the $Wd1_Sdevice\n"
return $FAIL
}
fi
trap_off
mv $Tmp_Wd $Wd_Sdevice > /dev/null 2>&1
mv $Tmp_Wd0 $Wd0_Sdevice > /dev/null 2>&1
mv $Tmp_Wd1 $Wd1_Sdevice > /dev/null 2>&1
trap_on
return $OK
}
#Mask Default IDE Card for OS version 5.0.0
mask_default_ide_5()
{
grep Y $Wd_Sdevice > /dev/null 2>&1
if [ $? -eq 0 ] ; then
sed "s/Y/N/" $Wd_Sdevice > $Tmp_Wd || {
echo "Enable to modify the $Wd_Sdevice\n"
return $FAIL
}
fi
mv $Tmp_Wd $Wd_Sdevice > /dev/null 2>&1
trap_on
return $OK
}
# Add the routine entry to the "/etc/conf/pack.d/hd/space.c"
add_hd_space_c()
{
# clear the previous setup
grep vth0 $HD_SPACE > /dev/null 2>&1
if [ $? -eq 0 ];then
ed $HD_SPACE > /dev/null 2>&1 <<EOF
/vth0
d
.
/vth0
d
.
w
EOF
fi
ed $HD_SPACE > /dev/null 2>&1 <<EOF
/wd0
a
extern int vth0pres(), vth0open(), vth0intr(), vth0halt();
.
/wd0
a
{vth0pres, vth0open, vth0intr, vth0halt, 1},
.
w
EOF
}
# Add the routine entry to the "/etc/conf/pack.d/hd/space.c" for OS version 5.0.0
add_hd_space_c_5()
{
# clear the privious setup
grep VTH_CNTLS $HD_SPACE > /dev/null 2>&1
if [ $? -eq 0 ];then
ed $HD_SPACE > /dev/null 2>&1 <<EOF
/VTH_CNTLS
.,.+2 d
.
/VTH_CNTLS
.,.+2 d
.
w
EOF
fi
ed $HD_SPACE > /dev/null 2>&1 <<EOF
/WD
/endif
.
a
#ifdef VTH_CNTLS
extern int vth0pres(), vth0open(), vth0close(), vth0intr(), vth0halt();
#endif
.
/WD
/endif
.
a
#ifdef VTH_CNTLS
{vth0pres, vth0open, vth0close, vth0intr, vth0halt, 1},
#endif
.
w
EOF
}
#Rebuild the kernel.
build_kernel()
{
cd $CONF
getyn "You must create and install a new kernel
to complete the $PRODUCT installation.
Do you wish to create a new kernel now" || {
getyn "The $PRODUCT software will not function until a
new kernel is re-linked and installed.
Do you wish to create a new kernel now" || {
exit $OK
}
}
echo "\nRe-linking the kernel ..." >&2
../bin/idbuild -y || {
echo "kernel link failed."
exit $FAIL
}
echo "
The system must be re-booted for the installation to be complete
Press <Return> to continue\c"
read x
}
# Turn on the trap.
trap_on() {
trap 'echo "\nThe installation is Interrupted! Exiting ! "; cleanup 1' 1 2 3 15
}
# Turn off the trap.
trap_off() {
trap '' 1 2 3 15
}
# Remove temp files and exit with the status passed as argument
cleanup() {
trap_off
rm -f $Tmp_Wd $Tmp_Wd0 $Tmp_Wd1 > /dev/null 2>&1
exit $1
}
# Get the Yes or No answer.
getyn()
{
while echo "\n$* (y/n)? \c">&2
do read yn rest
case $yn in
[yY]) return 0 ;;
[nN]) return 1 ;;
*) echo "Please answer y or n" >&2 ;;
esac
done
}
# Main
if [ "$VER" = "3.2" ]
then
linkpkg_check
cd /tmp/ID/vth
/etc/conf/bin/idcheck -p vth ; exit_code=$?
if [ $exit_code -lt 16 ] ; then
mkdir /etc/conf/pack.d/vth
/etc/conf/bin/idinstall -a -e -k -m -s -o -p -t vth
else
/etc/conf/bin/idinstall -u -e -k -m -s -o -p -t vth
fi
cd /tmp/ID/vth0
/etc/conf/bin/idcheck -p vth0 ; exit_code=$?
if [ $exit_code -lt 16 ] ; then
mkdir /etc/conf/pack.d/vth0
/etc/conf/bin/idinstall -a -e -k -m -s -o -p -t vth0
else
/etc/conf/bin/idinstall -u -e -k -m -s -o -p -t vth0
fi
if [ "$OSVER" = "5.0.0Cl" ]
then
cd /etc/conf/sdevice.d
cat vth0|awk -e '/vth0/ {$5=1; $6=14;OFS="\t";print $0}'>vth0.tmp
mv vth0.tmp vth0
fi
cd /tmp/ID/vth1
/etc/conf/bin/idcheck -p vth1 ; exit_code=$?
if [ $exit_code -lt 16 ] ; then
mkdir /etc/conf/pack.d/vth1
/etc/conf/bin/idinstall -a -e -k -m -s -o -p -t vth1
else
/etc/conf/bin/idinstall -u -e -k -m -s -o -p -t vth1
fi
if [ "$OSVER" = "5.0.0Cl" ]
then
cd /etc/conf/sdevice.d
cat vth1|awk -e '/vth1/ {$5=1;OFS="\t";print $0}'>vth1.tmp
mv vth1.tmp vth1
fi
echo "Disable default IDE driver !"
if [ "$OSVER" = "5.0.0Cl" ]
then
mask_default_ide_5
else
mask_default_ide
fi
echo "Disable default IDE driver successfully !\n"
echo "Change the IDE configuration file."
if [ "$OSVER" = "5.0.0Cl" ]
then
add_hd_space_c_5
else
add_hd_space_c
fi
echo "Change the IDE configuration file successfully !\n "
build_kernel
else
echo "This device driver must be installed on the SCO UNIX upper"
echo "\"3.2\" version.\n"
exit
fi