home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / SLAKWARE / MAKEFLOP next >
Text File  |  1997-04-19  |  17KB  |  562 lines

  1. #!/bin/sh
  2. # Copyright (C) 1993 David Niemi
  3. # The author places no restrictions on the use of this script.
  4.  
  5. #
  6. # Partial port to HP/UX by Michel Eyckmans (MCE) <eyckmans@imec.be>.
  7. # Only DOS formatting capability is missing.
  8. #
  9.  
  10. # this script requires mtools (except on HP/UX). If you don't have
  11. # it, get it from prep.ai.mit.edu: /pub/gnu or other GNU repositories.
  12.  
  13. # modified by Patrick Volkerding (volkerdi@mhd1.moorhead.msus.edu)
  14. # and IBM RS6000 compatibility by Torben N. Rasmussen (tnr@csd.cri.dk)
  15.  
  16. # Extensive cleanup/functionality additions by John Plocher (plocher@sun.com)
  17. # Provides interactive prompts to make disk mastering easier
  18. # Run this script in the directory containing the directories "a" "ap" ...
  19.  
  20. # Modified for Sun compatibility by Ted Kandell (ted@cashtrade.com)
  21. # Solaris 2.4 has a bug where the filesystem capacity for the floppy isn't reset
  22. # unless the new floppy is labelled with fdformat
  23. # Volume Management (vold) has a bug where the floppy device always is busy
  24. # even if there is nothing in the drive - the solution is to kill vold
  25. # Don't run Volume Management
  26.  
  27. # Edit this as needed
  28.  
  29. MTOOLS=/usr
  30.  
  31. # Global defaults
  32.  
  33. export PATH LD_LIBRARY_PATH
  34. LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/ucblib:$MTOOLS/lib
  35. PATH=$PATH:$MTOOLS/bin
  36.  
  37. format=$MTOOLS/bin/fdformat
  38. copy=$MTOOLS/bin/cp
  39. erase=$MTOOLS/bin/rm
  40. eject="eject floppy"
  41.  
  42. dollar='$'
  43.  
  44. set -e  # Exit on error
  45.  
  46. # Number of disks in each set
  47.  
  48. a=9
  49. ap=5
  50. d=13
  51. e=8
  52. f=3
  53. k=6
  54. n=6
  55. t=9
  56. tcl=2
  57. x=22
  58. xap=4
  59. xd=4
  60. xv=3
  61. y=2
  62.  
  63. # Descriptions of the packages
  64.  
  65. at="Base Linux"
  66. apt="Text based applications"
  67. dt="Program Development/GCC c|c++|obj-C kernel source and more"
  68. et="Emacs"
  69. ft="FAQs"
  70. kt="Kernel source and includes"
  71. nt="Networking/UUCP/Mail/News"
  72. tt="TeX"
  73. tclt="Tcl Script Language/Tk Toolkit"
  74. xt="XFree86 X Window System"
  75. xapt="X Applications"
  76. xdt="X11 Server Development"
  77. xvt="XView (OpenLook Window Manager)"
  78. yt="Games"
  79.  
  80. PACKAGES="a ap d e f k n t tcl x xap xd xv y"
  81.  
  82. ##########################################################################
  83. # These routines are only used on an hp/ux host
  84. #
  85. hpuxdosformat () {
  86.   echo "*** Warning *** No format on HP/UX, trying without !"
  87.   ## The mediainit utility can do a low level format, but there
  88.   ## seems to be no way to create an MS-DOS filesystem.
  89.   return 0
  90. }
  91.  
  92. hpuxdoserase() {
  93.   # HACK: We can ignore our $* here, since we just want to remove
  94.   #       everything anyway. HP/UX dos commands don't know about
  95.   #       filename completion, so we have to do it the hard way.
  96.   files=`dosls $FD`
  97.   if [ "$files" != '' ]
  98.   then
  99.       dosrm -r $files     
  100.   fi
  101. }
  102.  
  103. hpuxdoswrite() {
  104.   for file in $*
  105.   do
  106.       if [ "$file" != "$FD" ]
  107.       then
  108.       echo Copying $file ...
  109.           doscp -f $file $FD`basename $file`
  110.       fi
  111.   done
  112.   return 0
  113. }
  114.  
  115. hpuxeject(){
  116.   echo "Please eject floppy disk now"
  117. }
  118.  
  119. #       (End of HP/UX specific routines)
  120. ##########################################################################
  121.  
  122. ##########################################################################
  123. # These routines are only used on an aix host
  124. #
  125. aixdosformat () {
  126.   Echo "Formatting..."
  127.   dosformat > /dev/null << EOI
  128.  
  129. n
  130. EOI
  131.   echo "done"
  132.   return 0
  133. }
  134.  
  135. aixdoswrite() {
  136.   for file in $*; do
  137.     if [ "$file" != "$FD" ]; then
  138.       echo Copying $file ...
  139.       doswrite $file `basename $file` > /dev/null
  140.     fi
  141.   done
  142.   return 0
  143. }
  144.  
  145. aixeject(){
  146.   echo "Please eject floppy disk now"
  147. }
  148. #       (End of AIX specific routines)
  149. ##########################################################################
  150.  
  151. # Linux specific formatting routines:
  152.  
  153. Linuxaformat() {
  154.     fdformat /dev/fd0H1440
  155.         if [ $? = 0 ]; then
  156.          mformat a:
  157.         else
  158.          return 1;
  159.         fi
  160.         return $?
  161. }
  162.  
  163. Linuxbformat() {
  164.     fdformat /dev/fd1H1440
  165.         if [ $? = 0 ]; then
  166.          mformat b:
  167.         else
  168.          return 1;
  169.         fi
  170.         return $?
  171. }
  172.  
  173. ##########################################################################
  174. #                       Common routines
  175. ##########################################################################
  176.  
  177. Echo() {
  178.         if [ "`echo -n `" != "'-n'" ]
  179.     then
  180.             echo -n $*' '
  181.     else
  182.             echo $*' '"\c"
  183.     fi
  184. }
  185.  
  186. ##########################################################################
  187.  
  188. Prompt() { # => diskno alldone duplicate eraseit
  189.         my_IMAGE="$1"
  190.         my_default="$2"
  191.         my_disk="$3"
  192.         my_diskno="$4"
  193.         my_maxdisk="$5"
  194.         my_series="$6"
  195.         my_descrip="$7"
  196.  
  197.         valid_answer="no"
  198.         my_need_help="yes"
  199.         imagename=$my_diskno
  200.  
  201.         while [ "$valid_answer" = "no" ]; do
  202.                 if [ "$my_need_help" = "yes" ]; then
  203.                     my_need_help="no"
  204.                     echo "__"
  205.                   if [ -z "$my_IMAGE" ]; then
  206.                     echo "[$my_disk] disk $my_diskno of $my_maxdisk (${my_descrip})"
  207.                   else
  208.                     echo "[$my_disk] ${my_descrip}"
  209.                   fi
  210.                     echo "  Please insert a blank floppy and press"
  211.                     echo "    [q]  to Quit this program"
  212.                     echo "    [h]  to show this Help message"
  213.                     echo "    [f]  to Format floppy and duplicate disk image"
  214.                     echo "    [d]  to Duplicate disk image"
  215.                   if [ -z "$my_IMAGE" ]; then
  216.                     echo "    [l]  to List the contents of disk \"$my_series$my_diskno\""
  217.                     echo "    [sd] to Skip this Disk \"$my_series$my_diskno\""
  218.                     echo "    [ss] to Skip the entire \"$my_series\" Series"
  219.                   else
  220.                     echo "    [l]  to List the possible disk images"
  221.                     echo "    [c]  to Choose a disk image"
  222.                     echo "    [s]  to Skip this disk image"
  223.                     echo "    Current image: $my_diskno"
  224.                   fi
  225.                 fi
  226.  
  227.                 Echo "__Choice: [$my_default]: "
  228.                 answer="invalid"
  229.                 read answer junk
  230.                 if [ -z "$answer" ]; then
  231.                         answer="$my_default"
  232.                 fi
  233.     
  234.                 case $answer in
  235.                 q*) echo "Quitting"; exit 0 ;;
  236.                 h*) my_need_help=yes;;
  237.                 c*)
  238.                     if [ -n "$my_IMAGE" ]; then
  239.                         Echo "$disk image: [$my_diskno]: "
  240.                         read imagename junk
  241.                         if [ -z "$imagename" ]; then
  242.                             imagename="$default_image"
  243.                         fi
  244.                         if [ ! -r "$imagename" ]; then
  245.                            echo "ERROR: \"$imagename\" is not readable."
  246.                         else
  247.                            my_diskno=$imagename
  248.                         fi
  249.                     fi;
  250.                     ;;
  251.                 l*)
  252.                     if [ -z "$my_IMAGE" ]; then
  253.                         ls -Fl $my_series$my_diskno/.??* $my_series$my_diskno/* | cut -c30-41,54-
  254.                     else
  255.                         ls -Fl $my_IMAGE | cut -c30-41,54-
  256.                     fi
  257.                     duplicate=no
  258.                     alldone=no
  259.                     eraseit=no
  260.                     ;;
  261.                 sd)
  262.                     if [ -z "$my_IMAGE" ]; then
  263.                         alldone=yes
  264.                         valid_answer=yes
  265.                     else
  266.                         echo "ERROR: Invalid entry.  Try again"
  267.                     fi
  268.                     ;;
  269.                 ss)
  270.                     if [ -z "$my_IMAGE" ]; then
  271.                         diskno=$my_maxdisk;
  272.                         alldone=yes
  273.                         valid_answer=yes
  274.                     else
  275.                         echo "ERROR: Invalid entry.  Try again"
  276.                     fi
  277.                     ;;
  278.                 s*)
  279.                     if [ -z "$my_IMAGE" ]; then
  280.                         Echo "Skip what? [d]=disk [s]=series: [d]: "
  281.                         answer="invalid"
  282.                         read answer junk
  283.                         if [ -z "$answer" ]; then
  284.                                 answer="d"
  285.                         fi
  286.                         case $answer in
  287.