home *** CD-ROM | disk | FTP | other *** search
/ BUG 1 / BUGCD1996_0708.ISO / pc / util / minilin / minilin.exe / USR / LIB / SETUP / HDSETUP < prev    next >
Encoding:
Text File  |  1994-05-20  |  11.2 KB  |  347 lines

  1. #!/bin/sh
  2. #
  3. # Copyright 1993, 1994 Patrick Volkerding, Moorhead, Minnesota USA
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is 
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. #    notice, this list of conditions and the following disclaimer.
  11. #
  12. #  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
  13. #  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
  14. #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
  15. #  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  16. #  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. #  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. #  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
  19. #  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
  20. #  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
  21. #  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. #
  23. # As always, bug reports, suggestions, etc: volkerdi@mhd1.moorhead.msus.edu
  24. # or bf703@cleveland.freenet.edu, or (if you absolutely must) (218) 233-4349.
  25. #
  26. reset
  27. rm -f /tmp/SeT*
  28. touch /tmp/SeTcolor
  29. PATH="$PATH:/usr/lib/setup"
  30. export PATH;
  31. PARTLIST="`fdisk -l | fgrep "Linux native"`"
  32. echo "$PARTLIST" > /tmp/SeTplist
  33. T_PX="/"
  34. echo "$T_PX" > /tmp/SeTT_PX
  35. #DISTRIBUTION_SOURCE="/var/adm/mount"
  36. #echo "$DISTRIBUTION_SOURCE" > /tmp/SeTDS
  37. #SOURCE_DEVICE="/dev/fd0"
  38. # We may want to force the issue...
  39. # echo "$SOURCE_DEVICE" > /tmp/SeTsource
  40. ROOT_DEVICE="`mount | fgrep "on / " | cut -b-10`"
  41. echo "$ROOT_DEVICE" > /tmp/SeTrootdev
  42. if mount | fgrep /var/adm/mount 1> /dev/null 2> /dev/null ; then # clear source
  43.  umount /var/adm/mount                                           # location
  44. fi
  45. #if [ -d /mnt/etc -o /mnt/lost+found ]; then # nothing should be on /mnt here!
  46. # umount -a 1> /dev/null 2> /dev/null
  47. # mount /proc /proc -t proc
  48. #fi
  49. rm -f /var/adm/mount 2> /dev/null
  50. rmdir /var/adm/mount 2> /dev/null
  51. mkdir /var/adm/mount 2> /dev/null
  52.  
  53. while [ 0 ]; do
  54.  if [ -r /tmp/SeTQUICK ]; then
  55.   QUICK="QUICK"
  56.  else
  57.   QUICK="VERBOSE"
  58.  fi
  59.  
  60.  dialog --title "Slackware Linux Setup (version HD-2.0.0)" --menu "\nWelcome\
  61.  to Slackware Linux Setup.\n\
  62. \nHint: If you have trouble using the arrow keys on your keyboard,\n\
  63. you can use '+', '-', and TAB instead. Which option would you like?" 22 74 11 \
  64. "HELP" "Read the Slackware Setup HELP file" \
  65. "KEYMAP" "Remap your keyboard" \
  66. "QUICK" "Choose QUICK or VERBOSE install mode [now: $QUICK]" \
  67. "MAKE TAGS" "Tagfile customization program" \
  68. "TARGET" "Select target directory [now: $T_PX]" \
  69. "SOURCE" "Select source media" \
  70. "DISK SETS" "Decide which disk sets you wish to install" \
  71. "INSTALL" "Install selected disk sets" \
  72. "CONFIGURE" "Reconfigure your Linux system" \
  73. "PKGTOOL" "Install or remove packages with Pkgtool" \
  74. "EXIT" "Exit Slackware Linux Setup" 2> /tmp/hdset
  75.  if [ $? = 1 -o $? = 255 ]; then
  76.   rm -f /tmp/hdset /tmp/SeT*
  77.   reset
  78.   exit
  79.  fi
  80.  MAINSELECT="`cat /tmp/hdset`"
  81.  rm /tmp/hdset
  82.  
  83.  # Start checking what to do. Some modules may reset MAINSELECT to run the
  84.  # next item in line.
  85.  
  86.  if [ "$MAINSELECT" = "HELP" ]; then
  87.   SeTHELP
  88.  fi
  89.  
  90.  if [ "$MAINSELECT" = "QUICK" ]; then
  91.   SeTquick
  92.  fi
  93.  
  94.  if [ "$MAINSELECT" = "MAKE TAGS" ]; then
  95.   SeTmaketag
  96.  fi
  97.  
  98.  if [ "$MAINSELECT" = "KEYMAP" ]; then
  99.   SeTkeymap
  100.   if [ -r /tmp/SeTkeymap ]; then
  101.    dialog --title "CONTINUE?" --yesno "We're done with the KEYMAP section, \
  102. would you like to \
  103. go on to the SOURCE section?" 7 40
  104.    if [ $? = 0 ]; then
  105.     MAINSELECT="SOURCE" 
  106.    fi
  107.   fi
  108.  fi
  109.  
  110.  if [ "$MAINSELECT" = "SOURCE" ]; then
  111.   SeTmedia 
  112.   if [ -r /tmp/SeTsource -a ! -r /tmp/SeTSERIES ]; then
  113.    dialog --title "CONTINUE?" --yesno "Now that you've set up your source \
  114. location, would you like \
  115. to go on to the DISK SETS section and decide which disk sets you wish to \
  116. install?" 9 40
  117.    if [ $? = 0 ]; then
  118.     MAINSELECT="DISK SETS"
  119.    fi
  120.   elif [ -r /tmp/SeTsource -a -r /tmp/SeTSERIES ]; then
  121.    dialog --title "CONTINUE?" --yesno "Now that you've indicated \
  122. your source location and selected \
  123. the disk sets you want, you may begin the installation process, or you may \
  124. return to the main menu. Would you like to begin the installation?" 9 50
  125.    if [ $? = 0 ]; then
  126.     MAINSELECT="INSTALL"
  127.    fi
  128.   fi
  129.  fi
  130.  
  131.  if [ "$MAINSELECT" = "TARGET" ]; then
  132.   dialog --title "CHANGE TARGET DIRECTORY?" --yesno "The target \
  133. directory is the one the packages will be untarred \
  134. from. In most cases, there is no need to change this from the default \
  135. value of '/', but if you are installing Slackware Linux into a subdirectory \
  136. for some reason, then you'll want to change it. It's unlikely that the system \
  137. will run in a directory other \
  138. than '/', though. Are you sure you want to change \
  139. the target directory? " 11 70
  140.   if [ $? = 1 ]; then
  141.    continue;
  142.   fi
  143.   dialog --inputbox "What directory would you like \
  144. to install Slackware into?" \
  145.   9 40 2> /tmp/slackdir
  146.   if [ $? = 0 ]; then
  147.    T_PX="`cat /tmp/slackdir`"
  148.    mkdir -p $T_PX
  149.    echo "$T_PX" > /tmp/SeTT_PX
  150.   else
  151.    rm -f /tmp/slackdir 
  152.    continue
  153.   fi 
  154.   rm -f /tmp/slackdir
  155.  fi
  156.  
  157.  if [ "$MAINSELECT" = "DISK SETS" ]; then
  158.   SeTPKG
  159.   if [ -r /tmp/SeTSERIES -a -r /tmp/SeTsource ]; then
  160.    dialog --title "CONTINUE?" --yesno "Now that you've set up \
  161. the source location and decided \
  162. what you want to install, you can go ahead and begin the installation \
  163. process, or you can go back to the main menu. Do you want to start the INSTALL \
  164. section and begin installing software?" 10 55
  165.    if [ $? = 0 ]; then
  166.     MAINSELECT="INSTALL"
  167.    fi
  168.   fi
  169.  fi
  170.  
  171.  if [ "$MAINSELECT" = "INSTALL" ]; then
  172.   if [ ! -r /tmp/SeTSERIES -o ! -r /tmp/SeTsource -o ! /tmp/SeTnative ]; then
  173.    dialog --title "CANNOT INSTALL SOFTWARE YET" --msgbox "\
  174. \n\
  175. Before you can install software, complete the following tasks:\n\
  176. \n\
  177. 1. Select your source media.\n\
  178. 2. Select which disk sets to install.\n\
  179. \n\
  180. You may also optionally remap your keyboard or select a\n\
  181. different target directory than '/'.\n\
  182. \n\
  183. Press ENTER to return to the main menu." 15 68
  184.    continue
  185.   fi
  186.   SERIES="-sets `cat /tmp/SeTSERIES`"
  187.   SOURCE_DEVICE="`cat /tmp/SeTsource`"
  188.   IGNORE_TAGFILES=""
  189.   while [ 0 ]; do
  190.    if [ -r /tmp/SeTQUICK ]; then
  191.     MODE="Normal"
  192.     break;
  193.    fi
  194.    dialog --title "SELECT PROMPTING MODE" --menu "\
  195. \n\
  196. Now you must select which type of prompting you would like to\n\
  197. use while installing your software packages. If you're not\n\
  198. sure which mode to use, read the help file.\n\n\
  199. Which type of prompting would you like to use?\
  200. " 17 70 5 \
  201. "Normal" "Use the default tagfiles" \
  202. "Custom" "Use custom tagfiles in the package directories" \
  203. "Path" "Use tagfiles in the subdirectories of a custom path" \
  204. "None" "Use no tagfiles - install everything" \
  205. "HELP" "Read the prompt mode help file" 2> /tmp/SeTpmode
  206.    if [ $? = 1 -o $? = 255 ]; then
  207.     rm -f /tmp/SeTpmode
  208.     exit
  209.    fi
  210.    MODE="`cat /tmp/SeTpmode`"
  211.    rm -f /tmp/SeTtagext
  212.  
  213.    if [ "$MODE" = "Path" ]; then
  214.     dialog --title "PROVIDE A CUSTOM PATH TO YOUR TAGFILES" --inputbox "If \
  215. you're installing from CD-ROM, it's impossible to edit the tagfiles that are \
  216. in the package directories. In this case, you might want to provide a path to \
  217. your custom tagfiles. As an example, you could create a /tagfiles directory \
  218. and mount a floppy disk containing the tagfiles on that directory. Then you'd \
  219. enter '/tagfiles' at the prompt below. The setup program will look for your \
  220. tagfile in SUBDIRECTORIES of the path you provide, such as /tagfiles/a1, \
  221. /tagfiles/ap1, /tagfiles/d1, and so on. You only need to provide a \
  222. subdirectory and tagfile for the first disk of each series to be installed. \
  223. If a custom tagfile is not found at the path you provide, setup will revert to \
  224. the default tagfiles. Please enter the path to your custom tagfiles:" \
  225. 20 70 2> /tmp/SeTtagpath
  226.     if [ $? = 1 -o $? = 255 ]; then
  227.      continue
  228.     fi                                                              
  229.     if [ -r /tmp/SeTtagpath ]; then
  230.      if [ "`cat /tmp/SeTtagpath`" = "" ]; then
  231.       rm -f /tmp/SeTtagpath
  232.      fi
  233.     fi
  234.     break;
  235.    fi
  236.  
  237.    if [ "$MODE" = "HELP" ]; then
  238.     SeTprHELP
  239.    fi
  240.   
  241.    if [ "$MODE" = "Normal" ]; then 
  242.     break;
  243.    fi 
  244.  
  245.    if [ "$MODE" = "Custom" ]; then
  246.     dialog --title "ENTER CUSTOM EXTENSION" --inputbox "Now, enter the custom \
  247. extension you have used for your tagfiles. This must be a valid MS-DOS format \
  248. file extension consisting of a period followed by three characters. For \
  249. example, I use '.pat'. You might see my tagfiles on your disks. :^)" \
  250. 13 60 2> /tmp/SeTtagext
  251.     if [ $? = 1 -o $? = 255 ]; then
  252.      continue
  253.     fi
  254.     if [ -r /tmp/SeTtagext ]; then
  255.      if [ "`cat /tmp/SeTtagext`" = "" ]; then
  256.       rm -f /tmp/SeTtagext
  257.      fi
  258.     fi
  259.     break;
  260.    fi
  261.  
  262.    if [ "$MODE" = "None" ]; then
  263.     dialog --title "WARNING" --yesno "You should be advised that installing \
  264. *everything* is often a bad plan. If you're just putting the base system in \
  265. place and planning to install things like X and Emacs a little more \
  266. selectively from your hard drive later, then there's no problem. Otherwise, \
  267. if you try to install the whole thing without prompts you will not get as \
  268. optimal an installation as you might like. Are you sure you want to install \
  269. without prompts?" 13 60
  270.     if [ ! $? = 0 ]; then
  271.      continue
  272.     fi
  273.     IGNORE_TAGFILES="-ignore_tagfiles"
  274.     break;
  275.    fi
  276.  
  277.   done
  278.  
  279.   if [ "$IGNORE_TAGFILES" = "" ]; then
  280.    dialog --infobox "PROMPT mode selected. Using prompting defaults \
  281. found in tagfiles along the way." 4 50
  282.    sleep 3
  283.   else
  284.    IGNORE_TAGFILES="-ignore_tagfiles"
  285.    dialog --infobox "PROMPT mode not selected. Installing all the packages \
  286. on the selected disk sets." 4 50
  287.    sleep 3
  288.   fi
  289.   SOURCE_MOUNTED="`cat /tmp/SeTmount`"
  290.   DISTRIBUTION_SOURCE="`cat /tmp/SeTDS`"
  291.   if [ "$DISTRIBUTION_SOURCE" != "" ]; then
  292.    cpkgtool $SOURCE_MOUNTED $IGNORE_TAGFILES -source_device $SOURCE_DEVICE -source_dir $DISTRIBUTION_SOURCE -target_dir $T_PX $SERIES
  293.   else
  294.    cpkgtool $SOURCE_MOUNTED $IGNORE_TAGFILES -source_device $SOURCE_DEVICE -target_dir $T_PX $SERIES
  295.   fi
  296.   dialog --title "EXTRA CONFIGURATION" --yesno "If you wish, you may \
  297. now go through the options to reconfigure your hardware, make a \
  298. bootdisk, and install LILO, and run any other system scripts that \
  299. have been installed for you, such as the one to configure your \
  300. timezone, or set up your default baud rate.  If you've installed \
  301. a new kernel image, you should definately go through these steps \
  302. again. \
  303. Otherwise, it's up to you. \
  304. Reconfigure your system? " 12 60
  305.   if [ ! "$?" = "0" ]; then
  306.    continue
  307.   else
  308.    MAINSELECT="CONFIGURE"
  309.   fi
  310.  fi
  311.  
  312.  if [ "$MAINSELECT" = "CONFIGURE" ]; then
  313.   SeTconfig
  314.  fi
  315.  
  316.  if [ "$MAINSELECT" = "PKGTOOL" ]; then
  317.   cpkgtool
  318.  fi
  319.  
  320.  if [ "$MAINSELECT" = "EXIT" ]; then
  321.   rm -f /tmp/SeT*
  322.   reset
  323.   break
  324.  fi
  325.  
  326. done # end of main loop
  327.  
  328. rm -f /tmp/tagfile /tmp/SeT*
  329.  
  330. sync
  331. if mount | fgrep /var/adm/mount 1> /dev/null 2> /dev/null ; then
  332.  umount /var/adm/mount 
  333. fi
  334. rm -f /var/adm/mount 2> /dev/null
  335. rmdir /var/adm/mount 2> /dev/null
  336. mkdir /var/adm/mount 2> /dev/null
  337. chmod 755 /var/adm/mount
  338. if [ -r /tagfile ]; then
  339.  rm -f /tagfile
  340. fi
  341. chmod 755 $T_PX
  342. if [ -d $T_PX/tmp ]; then
  343.  chmod 1777 $T_PX/tmp
  344. fi
  345. # end slackware setup script
  346.