#!/bin/ksh 
#
#   @(#)svc_uninstall_xil13	1.3 99/01/27 
# 
# Remove SunVideo Compatibility Hierarchy  
# 
# Copyright (c) 1998 MultiMedia Access Corporation - Osprey Technologies Inc. 
# 600 Airport Blvd. Suite 900, Morrisville NC, 27560 USA. All Rights Reserved.
# 
# This product and related documentation is protected by copyright laws and 
# international treaties. No part of this product or related documentation  
# may be reproduced, distributed, or decompiled in any form by any means 
# without prior written authorization of MultiMedia Access Corporation. 
# Unauthorized reproduction or distribution of this program, or any part of 
# it, may result in severe civil and criminal penalties, and will be 
# prosecuted to the maximum extent possible under the law.
# 
# MMAC reserves the right to change any products herein at any time and 
# without notice. MMAC does not assume any liability arising from the 
# application or use of this product, except as expressly agreed to in 
# writing by MMAC. Use and purchase of this product does not convey a license
# under any patent rights, copyrights, trademark rights, or any other 
# intellectual property rights of MMAC, Sun Microsystems, or others. 
# 
 
progname=${0##*/}

XILDIR=/usr/openwin/lib/xil
DEVDIR=$XILDIR/devhandlers
DEVDIR_ORIG=$XILDIR/devhandlers_orig
NEWDEVDIR=$XILDIR/devhandlers_svc_o1k

verbose=""

USAGE=\
"usage: $progname [ opts ] 
        -v              -- verbose
"

fatal() {
    if [ "$1" ]
    then
        echo $* >&2
    fi
    echo "$USAGE" 1>&2
    exit 1
}    

#
# process options
#

while getopts vt:x:s: OPT
do
    case "$OPT" in
    	v) verbose="yes";;
        *)  echo $OPTARG
            fatal
    esac
done

[ "$verbose" ] && echo xil directory is $DEVDIR
[ "$verbose" ] && echo dest directory is $NEWDEVDIR

#
# check to make sure we are on correct os
#
if [ ! -f /usr/openwin/lib/xil/config ]
then
   echo "XIL 1.3 is not on this system"
   echo "This script is applicable for Solaris 2.6 or greater"
   OS=`uname -r`
   echo "Current OS detected as SunOS $OS"
   exit 2
fi

#
# check to make sure devhandlers symbolic link
#
if [ ! -L $DEVDIR ]
then
    [ "$verbose" ] && echo "SVC does not appear to be installed."
    exit 0
fi

#
# check to make o1k svc installed
#
 
if [ ! -f $DEVDIR/svc_o1k_marker ]
then
    [ "$verbose" ] && echo "SVC mode for o1k device not found in $DEVDIR"
    exit 0
fi

rm $DEVDIR
mv $DEVDIR_ORIG $DEVDIR
rm -rf $NEWDEVDIR

echo "SVC XIL 1.3 hierarchy has been removed."



