home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / tls / tls002.2.Z / tls002.2 / usr / lib / custom / s3cddx.rmv
Encoding:
Text File  |  1992-01-13  |  2.5 KB  |  168 lines

  1. :
  2. #    s3cddx.rmv
  3. #
  4. #    Copyright (C) 1991 Xware.
  5. #
  6.  
  7. PATH=/bin:/usr/bin:/etc:/etc/conf/bin
  8. PERM=/etc/perms/inst            # OS (link kit) permlist
  9.  
  10. : ${OK=0} ${FAIL=1}
  11.  
  12. #
  13. # exit with the status passed as argument
  14. #
  15.  
  16. cleanup() 
  17. {
  18.     trap '' 1 2 3 15
  19.     exit $1
  20. }
  21.  
  22. #
  23. # prompt for yes or no answer with message passed as argument - 
  24. # returns non-zero for no
  25. #
  26.  
  27. getyn() 
  28. {
  29.     while    echo "\n$* (y/n) \c">&2
  30.     do    read yn rest
  31.         case $yn in
  32.         [yY])    return 0                 ;;
  33.         [nN])    return 1                ;;
  34.         *)    echo "Please answer y or n" >&2        ;;
  35.         esac
  36.     done
  37. }
  38.  
  39. #
  40. # test to see if link kit is installed
  41. #
  42.  
  43. chklinkkit() 
  44. {
  45.         echo "Checking Link Kit installation..."
  46.         until    fixperm -i -d LINK $PERM 2> /dev/null
  47.         do    case $? in
  48.         3|4)    echo "The Link Kit is not installed." >&2
  49.             ;;
  50.         5)    echo "The Link Kit is only partially installed." >&2
  51.             echo "Attempting to remove TCP/IP package anyway." >&2
  52.             return 0
  53.             ;;
  54.         *)    echo "Error testing for Link Kit. Exiting."; cleanup 1
  55.             ;;
  56.         esac
  57.  
  58.         #
  59.         # Not fully installed. Do so here
  60.         #
  61.  
  62.         while    echo "Do you wish to install it now? (y/n) \c"
  63.         do    read ANSWER
  64.             case $ANSWER in
  65.             Y|y)    custom -o -i LINK
  66.                 break
  67.                 ;;
  68.             N|n)    echo "Driver cannot be removed without the Link Kit."
  69.                 cleanup 1
  70.                 ;;
  71.             *)    echo "Please answer 'y' or 'n'. \c"
  72.                 ;;
  73.             esac
  74.         done
  75.         done
  76. }
  77.  
  78. #
  79. # relink the kernel
  80. #
  81.  
  82. relink() 
  83. {
  84.         cd /etc/conf/cf.d
  85.         echo "\nRe-linking the kernel ... \c">&2
  86.         ./link_unix 2>&1 | tee -a kmakelog || 
  87.     {
  88.             echo "\nError:  Kernel link failed.
  89. Check /etc/conf/cf.d/kmakelog for details." >&2
  90.             cleanup 1
  91.         }
  92.         rm -f kmakelog
  93.         return 0
  94. }
  95.  
  96. #
  97. # main()
  98. #
  99.  
  100. cd /
  101.  
  102. trap 'echo "\nInterrupted! Exiting ..."; cleanup 1' 1 2 3 15
  103.  
  104. #
  105. # if no arguments given, default is ALL
  106. #
  107.     
  108. if [ -z "$*" ] ; then
  109.         args="ALL"
  110. else
  111.         args="$*"
  112. fi
  113.  
  114. #
  115. # set flags for each package to be removed
  116. #
  117.  
  118. for i in $args
  119. do
  120.     case $i in
  121.     "ALL" | "all")
  122.         REMOVE_S3CDDX="YES"
  123.         REMOVE_S3CCON="YES"
  124.         ;;
  125.     "S3CDDX"|"s3cddx")
  126.         REMOVE_S3CDDX="YES"
  127.         ;;
  128.     "S3CCON"|"s3ccon")
  129.         REMOVE_S3CCON="YES"
  130.         ;;
  131.     *)
  132.         REMOVE_S3CDDX=""
  133.         REMOVE_S3CCON=""
  134.         ;;
  135.     esac
  136. done
  137.  
  138. if [ -n "$REMOVE_S3CDDX" ] ; then
  139.     echo "Removing S3 86C911 Carrera DDX..." 2>/dev/null
  140.     mkdev graphics
  141. fi
  142.  
  143. if [ -n "$REMOVE_S3CCON" ] ; then
  144.     echo "Removing S3 86C911 Console Driver Patch..." 2>/dev/null
  145.  
  146.     #
  147.     # check for linkkit
  148.     #
  149.  
  150.         chklinkkit
  151.  
  152.     #
  153.     # resore the original VGA console driver
  154.     #
  155.  
  156.     mv /etc/conf/pack.d/vga/Driver.ORG /etc/conf/pack.d/vga/Driver.o
  157.  
  158.     #
  159.     # build the kernel
  160.     #
  161.     
  162.     cd /etc/conf/cf.d
  163.     ./link_unix
  164. fi
  165.  
  166. cleanup 0
  167.  
  168.