home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / etc / etc.hcx9 / load_diags < prev    next >
Encoding:
Text File  |  1987-04-30  |  3.6 KB  |  145 lines

  1.  
  2. #
  3. #    load_diags is a shell script designed to automatically
  4. #    load ("tar" in) diagnostic products from tape.
  5. #
  6.  
  7. 2> /dev/null
  8. > /etc/test_permission
  9. if [ -r /etc/test_permission ]    # test if user is root
  10. then
  11.     rm -f /etc/test_permission
  12. else
  13.     echo "\n\n\n   *******************************\c"
  14.     echo "*************************************"
  15.     echo "   * You must be logged in as root\c"
  16.     echo " to run the load_diags shell script *"
  17.     echo "   *******************************\c"
  18.     echo "*************************************\n\n\n"
  19.     echo ""
  20.     exit 1
  21. fi
  22.  
  23.  
  24. class2=true            # initialize load flags for 
  25. class4=true            # the diagnostic classes.
  26.  
  27. if [ -d /usr/d ]
  28. then
  29.     echo "\n   \c"
  30.     echo "The standalone diagnostic directory ( /usr/d ) already exists."
  31.     echo "   \c"
  32.     echo "Do you want to RELOAD the \"/usr/d\" directory ? (y/n) \c"
  33.     read answer
  34.     if [ x$answer != xy -a x$answer != xY ]
  35.     then
  36.         class2=false 
  37.     else
  38.         echo "   \c"
  39.         echo "Removing all files under /usr/d..."
  40.         rm -f /usr/d/* 2>/dev/null >/dev/null
  41.     fi
  42. fi
  43.  
  44. if [ -d /usr/d/system ]
  45. then
  46.     echo "\n   \c"
  47.     echo "The system level test directory ( /usr/d/system ) already exists."
  48.     echo "   \c"
  49.     echo "Do you want to RELOAD the \"/usr/d/system\" directory ? (y/n) \c"
  50.     read answer
  51.     if [ x$answer != xy -a x$answer != xY ]
  52.     then
  53.         class4=false 
  54.     else
  55.         echo "   \c"
  56.         echo "Removing all files under /usr/d/system..."
  57.         rm -rf /usr/d/system
  58.     fi
  59. fi
  60.  
  61. cd /                # change directory to root 
  62.  
  63. if [ $class2 = true -a $class4 = true ]
  64. then
  65.       echo "\n   \c"
  66.       echo "  Loading Class 2 Diagnostic Products, Preliminary Release 2-2.0E\c"
  67.       echo "\n   \c"
  68.       echo "  and     Class 4 Diagnostic Products, Preliminary Release 4-2.0G"
  69.     TAR="/usr/bin/tar xvb 18 usr/d"
  70.  
  71. elif [ $class2 = true ]
  72. then
  73.       echo "\n   \c"
  74.       echo "  Loading Class 2 Diagnostic Products, Preliminary Release 2-2.0E"
  75.     TAR="/usr/bin/tar xvb 18 all_s demand dmp1 dmp2 dmp3 dual_all_s dual_fall_s ether ether217 event fall_s fpdmp fpevent fpmacro hdc210 hmtc221 hvioc218 ioboth lister macro memtst mmtest pits poc_er_codes rtclk vioc231"
  76.  
  77. elif [ $class4 = true ] 
  78. then 
  79.      echo "  Loading Class 4 Diagnostic Products, Preliminary Release 4-2.0G"
  80.     TAR="/usr/bin/tar xvb 18 usr/d/system" 
  81. else 
  82.     echo "\nNO FILES LOADED" 
  83.     exit 1
  84. fi  
  85.  
  86. echo "\n   \c"
  87. echo "  Load the DIAGNOSTIC PRODUCTS TAPE, Product #9814050 (tar format)\c"
  88. echo "\n   \c"
  89. echo "             and put the tape drive on-line please. "
  90. echo "\n   \c"
  91. echo "*****************  Hit <RETURN> key when ready    ******************\c"
  92. echo "\c"
  93. read return
  94.  
  95. tar_err=true
  96.  
  97. while [ $tar_err = true ]
  98. do
  99.  
  100. if [ $class2 = true -a $class4 = false ]
  101. then
  102.     echo "\n   \c"
  103.     echo "Tar searching forward on tape for class2 diags..."
  104. fi
  105. $TAR
  106.  
  107. if [ $? -eq 0 ]
  108. then
  109.     break
  110. fi
  111.  
  112. echo "\n   \c"
  113. echo "********************************************************************"
  114. echo "   \c"
  115. echo "*                                                                  *"
  116. echo "   \c"
  117. echo "* ERROR generated while attempting to \"tar\" in diagnostic products.*"
  118. echo "   \c"
  119. echo "*                                                                  *"
  120. echo "   \c"
  121. echo "* Load the DIAGNOSTIC PRODUCTS TAPE, Product #9814050 (tar format) *"
  122. echo "   \c"
  123. echo "*            and put the tape drive on-line please.                *"
  124. echo "   \c"
  125. echo "*                                                                  *"
  126. echo "   \c"
  127. echo "**********  Hit <RETURN> key when ready, or enter Q to quit ********\c"
  128. echo "\c"
  129.     read return
  130.  
  131.     if [ X$return = XQ -o X$return = Xq ] 
  132.     then
  133.         exit 0
  134.     fi
  135. done
  136.  
  137. if [ $class2 = true ]
  138. then
  139.     if [ ! -d /d ]
  140.     then 
  141.         mkdir /d
  142.     fi
  143.     cp /usr/d/poc_er_codes /d/poc_er_codes
  144. fi
  145.