home *** CD-ROM | disk | FTP | other *** search
/ Jason Aller Floppy Collection / 204.img / SC386BN1.TD0 / etc / dkinit < prev    next >
Encoding:
Text File  |  1988-07-27  |  2.3 KB  |  138 lines

  1. :
  2. #    @(#) dkinit.sh 1.9 88/07/26 
  3. #
  4. #    Copyright (C) The Santa Cruz Operation, 1986.
  5. #    This Module contains Proprietary Information of
  6. #    The Santa Cruz Operation, Microsoft Corporation
  7. #    and AT&T, and should be treated as Confidential.
  8. #
  9. # DKINIT    - XENIX System V hard disk initialization with 
  10. #          non-standard disk support.
  11. #
  12. # Version 1.0    - 09/29/86
  13.  
  14. Getdfl() {
  15.     read prm1 prm2 prm3 prm4 prm5 prm6 prm7 prm8 < /tmp/dkinit$$
  16. }
  17. Showdfl() {
  18.     echo "
  19.     Disk Parameters        Values
  20.     ---------------         ------
  21.     1. Cylinders        $prm1
  22.     2. Heads        $prm2
  23.     3. Write Reduce        $prm3
  24.     4. Write Precomp    $prm4
  25.     5. Ecc            $prm5
  26.     6. Control        $prm6
  27.     7. Landing Zone        $prm7
  28.     8. Sectors/track    $prm8"
  29. }
  30.  
  31. modified=
  32.  
  33. case $# in
  34. 1) controller=0
  35.     ;;
  36. 2) case "$2" in
  37.     0)    controller=0
  38.         ;;
  39.     1)    controller=1
  40.         ;;
  41.     *)
  42.         echo "USAGE: dkinit drive-number (0|1) [controller-number (0|1)]"
  43.         exit 1
  44.         ;;
  45.     esac
  46.     ;;
  47. *)
  48.     echo "USAGE: dkinit drive-number (0|1) [controller-number (0|1)]"
  49.     exit 1
  50.     ;;
  51. esac
  52.  
  53. case $1 in
  54. 0)    if [ $controller -eq 0 ]
  55.     then
  56.         dparam -w
  57.         dn=0
  58.     else
  59.         dn=4
  60.     fi
  61.     ;;
  62. 1)    if [ $controller -eq 0 ]
  63.     then
  64.         dn=1
  65.     else
  66.         dn=5
  67.     fi
  68.     ;;
  69. *)
  70.     echo "USAGE: dkinit drive-number (0|1) [controller-number (0|1)]"
  71.     exit 1
  72.     ;;
  73. esac
  74.  
  75. dparam /dev/rdsk/${dn}s0 > /tmp/dkinit$$
  76. Getdfl
  77.  
  78. while echo "\nHard Disk Drive $dn Configuration
  79.  
  80.     1. Display current disk parameters
  81.     2. Modify current disk parameters
  82.     3. Select default disk parameters
  83.  
  84. Enter an option or 'q' to quit: \c"
  85. do
  86.     read ans
  87.     case "$ans" in
  88.     1)    Showdfl
  89.         ;;
  90.     2)
  91.         Showdfl
  92.         while echo "\nEnter a parameter to modify or 'q' to return to the main menu: \c"
  93.         do
  94.             read y
  95.             case "$y" in
  96.             [1-8])    while echo "\nEnter the new value or <RETURN> to use the existing value: \c"
  97.                 do
  98.                     read z
  99.                     case "$z" in
  100.                     [0-9]*)
  101.                         eval prm$y=$z
  102.                         modified=1
  103.                         break
  104.                         ;;
  105.                     "")    break
  106.                         ;;
  107.                     *)    echo "Please enter a numeric value. \n"
  108.                         ;;
  109.                     esac
  110.                 done
  111.                 ;;
  112.             [qQ])    break
  113.                 ;;
  114.             *)    echo "Please enter a choice, 1-8 or 'q'. \n"
  115.                 ;;
  116.             esac
  117.         done
  118.         ;;
  119.     3)    [ $modified ] && {
  120.             Getdfl
  121.             Showdfl
  122.             }
  123.         ;;
  124.     [qQ])    
  125.         [ $modified ] && {
  126.             case $dn in
  127.             1)        dparam -w    ;;
  128.             4|5)    dparam -w /dev/dsk/4s0    ;;
  129.             esac
  130.             dparam /dev/rdsk/${dn}s0 $prm1 $prm2 $prm3 $prm4 $prm5 $prm6 $prm7 $prm8
  131.             }
  132.         break
  133.         ;;
  134.     *)    echo "\nPlease enter '1', '2', '3' or 'q'.\n"
  135.         ;;
  136.     esac
  137. done
  138.