home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / biz / sco / general / 4926 < prev    next >
Encoding:
Text File  |  1993-01-01  |  5.3 KB  |  190 lines

  1. Newsgroups: biz.sco.general
  2. From: fred@genesis.demon.co.uk (Lawrence Kirby)
  3. Path: sparky!uunet!pipex!demon!genesis.demon.co.uk!fred
  4. Subject: Re: SCO Compability with OS/2? 
  5. Distribution: world
  6. References: <1992Dec29.190645.1958@allink.com>
  7. Organization: BT
  8. X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
  9. Lines: 172
  10. Date: Fri, 1 Jan 1993 12:17:34 +0000
  11. Message-ID: <725890654snz@genesis.demon.co.uk>
  12. Sender: usenet@demon.co.uk
  13.  
  14. In article <1992Dec29.190645.1958@allink.com> leonard@allink.com writes:
  15.  
  16. >>I was trying out OS/2 at one point and hit this problem. My solution was to
  17. >>create patched versions of the /dos file which allowed me to start the
  18. >>partitions I wanted. So that, for example, typing bm at the Boot: prompt would
  19. >>start up OS/2 Boot Manager. This worked. I'm not using OS/2 now but if you
  20. > like
  21. >>I could fish out the script. It means booting OS/2 is a 2-3 stage process but
  22. >>it is much easier than messing around with FDISK.
  23. >>
  24. >        Yes!  I am in need for just such a tool.  Please send this over
  25. >the net!
  26. >
  27.  
  28. OK - here it is.
  29.  
  30. ---cut---cut---cut---cut---cut---cut---cut---cut---cut---cut---cut---cut---
  31. :
  32. #    @(#) bootpart.sh  V 1.01
  33. #
  34. #    By L.I.Kirby      70734.126@compuserve.com, fred@genesis.demon.co.uk
  35. #    Distribute freely
  36. #
  37. # Generates variants of the /dos file in SCO systems to allow partitions other
  38. # than Unix/Xenix or DOS to be booted.
  39.  
  40. SRCDEF=/dos
  41.  
  42. getinp() {
  43.     default=$1
  44.     shift
  45.     while echo "$*\c"
  46.     do
  47.         read line
  48.         case $line in
  49.         Q|q)    exit 1
  50.         ;;
  51.         "")    if [ "$default" ]
  52.             then
  53.                 line=$default
  54.                 echo "Using $default default"
  55.                 return 0
  56.             fi
  57.         ;;
  58.         *)    return 0
  59.         esac
  60.     done
  61. }
  62.  
  63. getlen() {
  64. srclen=$5
  65. }
  66.  
  67. echo "\n\nSCO Unix/Xenix is supplied with a file called 'dos' in the root directory"
  68. echo "which permits you to boot a DOS partition on your hard disk from the"
  69. echo "Boot prompt. It is possible to boot up other partitions by invoking a"
  70. echo "suitable variant of the 'dos' file. This script is designed to create"
  71. echo "these variants based on your original 'dos' file.\n"
  72. echo "There are several ways to specify the target partition. Probably the"
  73. echo "simplest is by partition number. This will work for a particular installation"
  74. echo "until the partition table is rearranged. You may alternatively specify"
  75. echo "either one or two partition types if you know the correct values. This"
  76. echo "is more system independent. For two types the highest partition with a type"
  77. echo "that matches either value is booted. Please note partition values should be"
  78. echo "entered in octal without a leading zero.\n"
  79. echo "This script will patch older SCO dos files with a file length of 577 bytes"
  80. echo "or the new dos file in SCO Unix 3.2.4."
  81. echo "The new file should be placed in the root directory and its name defines"
  82. echo "the command you type at the boot prompt to start it.\n"
  83. echo "Some typical partition types are (in octal):"
  84. echo "1  DOS FAT < 16Mbyte     4 DOS FAT > 16 < 32Mbyte     6 DOS FAT  > 32Mbyte"
  85. echo "2  Xenix 1               3 Xenix 2"
  86. echo "7  IFS (e.g. OS/2 HPFS)  12 OS/2 Boot manager\n"
  87.  
  88. getinp "$SRCDEF" "Enter name of souce file (default $SRCDEF) "
  89. srcfile=$line
  90. echo
  91.  
  92. [ -r "$srcfile" ] || { echo "Sorry, can't read source file $srcfile"; exit 1; }
  93.  
  94. getlen `ls -l "$srcfile"`
  95. case $srclen in
  96. 577)
  97.     ver324=false
  98. ;;
  99. 584)
  100.     ver324=true
  101. ;;
  102. *)
  103.     echo Source file is not suitable
  104.     exit 1
  105. esac
  106.  
  107. getinp "" "Enter name of new file (should be root directory) "
  108. destfile=$line
  109.  
  110. echo "\nYou may specify:"
  111. echo "a) a partition number"
  112. echo "b) one partition type"
  113. echo "c) two partition types"
  114. while getinp "" "Enter option required (a-c) "
  115. do
  116.     boottype=$line
  117.     case $boottype in
  118.     a|A)
  119.         echo "\nPlease note that different programs (such as DOS fdisk) can report different"
  120.         echo "numbers for the partitions so some trial and error may be required.\n"
  121.         while getinp "" "Enter partition number (1-4) "
  122.         do
  123.             partnum=$line
  124.             case $partnum in
  125.             1|2|3|4) break
  126.             esac
  127.         done
  128.         break
  129.         ;;
  130.     b|B)
  131.         echo
  132.         getinp "" "Enter partition type (octal) "
  133.         parttype=$line
  134.         break
  135.         ;;
  136.     c|C)
  137.         echo
  138.         getinp "" "Enter partition type 1 (octal) "
  139.         parttype1=$line
  140.         echo
  141.         getinp "" "Enter partition type 2 (octal) "
  142.         parttype2=$line
  143.         break
  144.     ;;
  145.     *)
  146.         continue
  147.     esac
  148. done
  149.  
  150. # Create new boot file
  151.  
  152. echo "\nCreating $destfile...\n"
  153.     
  154. rm -f "$destfile"
  155. dd if="$srcfile" of="$destfile" bs=247 count=1
  156.  
  157. if $ver324
  158. then
  159.     echo -n "\0220\0220\0220\0220\0220\0220\0220" >> "$destfile"
  160.     rpos=266
  161. else
  162.     rpos=259
  163. fi
  164.  
  165. case $boottype in
  166. a|A)
  167.     echo -n "\0220\0220\0220\0220\0220\0220\0220\0220\0220\0203\0371\0$partnum" >> "$destfile"
  168.     ;;
  169. b|B)
  170.     echo -n "\0220\0220\0220\0220\0220\0220\0220\046\0200\0174\04\0$parttype" >> "$destfile"
  171.     ;;
  172. c|C)
  173.     echo -n "\046\0200\0174\04\0$parttype1\0164\07\046\0200\0174\04\0$parttype2" >> "$destfile"
  174. esac
  175.  
  176. dd if="$srcfile" of="$destfile" bs=$rpos seek=1 skip=1
  177. chmod 400 "$destfile"
  178. chgrp bin "$destfile"
  179. chown bin "$destfile"
  180.  
  181. echo "\n"`basename $destfile`" has now been created. Use this name at the Unix/Xenix Boot"
  182. echo "prompt to start up the other partition. You may still press <enter> or type"
  183. echo "dos as normal to start up Unix/Xenix or DOS respectively."
  184. ---cut---cut---cut---cut---cut---cut---cut---cut---cut---cut---cut---cut---
  185.  
  186. -----------------------------------------
  187. Lawrence Kirby | fred@genesis.demon.co.uk
  188. Wilts, England | 70734.126@compuserve.com
  189. -----------------------------------------
  190.