home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / ROOTDSKS.144 / COLOR144 / usr / lib / setup / fdsetup < prev    next >
Encoding:
Text File  |  1995-02-27  |  11.7 KB  |  364 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. echo "on" > /tmp/SeTcolor # turn on color menus
  29. PATH="$PATH:/usr/lib/setup"
  30. export PATH;
  31. PARTLIST="`fdisk -l | fgrep "Linux native" 2> /dev/null`"
  32. if [ "$PARTLIST" = "" ]; then
  33.  SeTnopart
  34.  exit
  35. fi
  36. echo "$PARTLIST" > /tmp/SeTplist
  37. T_PX="/mnt"
  38. echo "$T_PX" > /tmp/SeTT_PX
  39. #DISTRIBUTION_SOURCE="/var/adm/mount"
  40. #echo "$DISTRIBUTION_SOURCE" > /tmp/SeTDS
  41. #SOURCE_DEVICE="/dev/fd0"
  42. # We may want to force the issue...
  43. # echo "$SOURCE_DEVICE" > /tmp/SeTsource
  44. ROOT_DEVICE="`mount | fgrep "on / " | cut -b-10`"
  45. echo "$ROOT_DEVICE" > /tmp/SeTrootdev
  46. if mount | fgrep /var/adm/mount 1> /dev/null 2> /dev/null ; then # clear source
  47.  umount /var/adm/mount                                           # location
  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.  
  55.  if [ -r /tmp/SeTQUICK ]; then
  56.   QUICK="QUICK"
  57.  else
  58.   QUICK="VERBOSE"
  59.  fi
  60.  dialog --title "Slackware Linux Setup (version FD-2.2.0)" \
  61. --menu \
  62. "Welcome to Slackware Linux Setup.\n\
  63. Select an option below using the UP/DOWN keys and SPACE or ENTER.\n\
  64. Alternate keys may also be used: '+', '-', and TAB." 20 72 11 \
  65. "HELP" "Read the Slackware Setup HELP file" \
  66. "KEYMAP" "Remap your keyboard if you're not using a US one" \
  67. "QUICK" "Choose quick or verbose install mode [now: $QUICK]" \
  68. "MAKE TAGS" "Experts may customize tagfiles to preselect packages" \
  69. "ADDSWAP" "Set up your swap partition(s)" \
  70. "TARGET" "Set up your target partitions" \
  71. "SOURCE" "Select source media" \
  72. "DISK SETS" "Decide which disk sets you wish to install" \
  73. "INSTALL" "Install selected disk sets" \
  74. "CONFIGURE" "Reconfigure your Linux system" \
  75. "EXIT" "Exit Slackware Linux Setup" 2> /tmp/hdset
  76.  if [ $? = 1 -o $? = 255 ]; then
  77.   rm -f /tmp/hdset /tmp/SeT*
  78.   reset
  79.   exit
  80.  fi
  81.  MAINSELECT="`cat /tmp/hdset`"
  82.  rm /tmp/hdset
  83.  
  84.  # Start checking what to do. Some modules may reset MAINSELECT to run the
  85.  # next item in line.
  86.  
  87.  if [ "$MAINSELECT" = "HELP" ]; then
  88.   SeTfdHELP
  89.  fi
  90.  
  91.  if [ "$MAINSELECT" = "QUICK" ]; then
  92.   SeTquick
  93.  fi
  94.  
  95.  if [ "$MAINSELECT" = "KEYMAP" ]; then
  96.   SeTkeymap
  97.   if [ -r /tmp/SeTkeymap ]; then
  98.    dialog --yesno "We're done with the KEYMAP section, would you like to \
  99. set up your swap space?" 9 40
  100.    if [ $? = 0 ]; then
  101.     MAINSELECT="ADDSWAP" 
  102.    fi
  103.   fi
  104.  fi
  105.  
  106.  if [ "$MAINSELECT" = "MAKE TAGS" ]; then
  107.   SeTmaketag
  108.  fi
  109.  
  110.  if [ "$MAINSELECT" = "ADDSWAP" ]; then
  111.   SeTswap
  112.   if [ -r /tmp/SeTswap ]; then
  113.    dialog --title "CONTINUE WITH INSTALLATION?" --yesno "Now that you've set \
  114. up your swap space, you may continue on with the installation. Otherwise, \
  115. you'll be returned to the main menu. Would you like to continue the \
  116. installation and set up your TARGET drive(s)?" 9 60
  117.    if [ $? = 0 ]; then
  118.     MAINSELECT="TARGET"
  119.    fi
  120.   fi
  121.  fi
  122.  
  123.  if [ "$MAINSELECT" = "TARGET" ]; then
  124.   SeTpartitions
  125.   SeTDOS
  126.   if [ -r /tmp/SeTnative ]; then
  127.    dialog --title "CONTINUE?" --yesno "Now that you've set up your target \
  128. partitions, would you like to go on to the SOURCE section and select your \
  129. installation media?" 7 60
  130.    if [ $? = 0 ]; then
  131.     MAINSELECT="SOURCE"
  132.    fi
  133.   fi
  134.  fi
  135.  
  136.  if [ "$MAINSELECT" = "SOURCE" ]; then
  137.   SeTmedia 
  138.   if [ -r /tmp/SeTsource ]; then
  139.    dialog --title "CONTINUE?" --yesno "Would you like to go on to the \
  140. DISK SETS section and select which catagories of software to install?" 6 60
  141.    if [ $? = 0 ]; then
  142.     MAINSELECT="DISK SETS"
  143.    fi
  144.   fi
  145.  fi
  146.  
  147.  if [ "$MAINSELECT" = "DISK SETS" ]; then
  148.   SeTPKG
  149.   if [ -r /tmp/SeTSERIES ]; then
  150.    dialog --title "CONTINUE?" --yesno "Now that you've decided what you want to install you may \
  151. begin the installation process by moving to the INSTALL section. Please note \
  152. that if you have not completed all the prerequisites you will be informed of \
  153. this and returned to the main menu. Would you like to go on to the INSTALL \
  154. section?" 11 60
  155.    if [ $? = 0 ]; then
  156.     MAINSELECT="INSTALL"
  157.    fi
  158.   fi
  159.  fi
  160.  
  161.  if [ "$MAINSELECT" = "INSTALL" ]; then
  162.   if [ ! -r /tmp/SeTSERIES -o ! -r /tmp/SeTsource -o ! /tmp/SeTnative ]; then
  163.    dialog --title "CANNOT INSTALL SOFTWARE YET" --msgbox "\
  164. \n\
  165. Before you can install software, complete the following tasks:\n\
  166. \n\
  167. 1. Select your source media.\n\
  168. 2. Set up your target Linux partition(s).\n\
  169. 3. Select which disk sets to install.\n\
  170. \n\
  171. You may also optionally remap your keyboard and set up your\n\
  172. swap partition(s). \n\
  173. \n\
  174. Press ENTER to return to the main menu." 16 68
  175.    continue
  176.   fi
  177.   SERIES="-sets `cat /tmp/SeTSERIES`"
  178.   SOURCE_DEVICE="`cat /tmp/SeTsource`"
  179.   IGNORE_TAGFILES=""
  180.   while [ 0 ]; do
  181.    if [ -r /tmp/SeTQUICK ]; then
  182.     MODE="Normal"
  183.     break;
  184.    fi
  185.    dialog --title "SELECT PROMPTING MODE" --menu "\
  186. \n\
  187. Now you must select which type of prompting you would like to\n\
  188. use while installing your software packages. If you're not\n\
  189. sure which mode to use, read the help file.\n\n\
  190. Which type of prompting would you like to use?\
  191. " 17 70 5 \
  192. "Normal" "Use the default tagfiles" \
  193. "Custom" "Use custom tagfiles in the package directories" \
  194. "Path" "Use tagfiles in the subdirectories of a custom path" \
  195. "None" "Use no tagfiles - install everything" \
  196. "HELP" "Read the prompt mode help file" 2> /tmp/SeTpmode
  197.    if [ $? = 1 -o $? = 255 ]; then
  198.     rm -f /tmp/SeTpmode
  199.     exit
  200.    fi
  201.    MODE="`cat /tmp/SeTpmode`"
  202.    rm -f /tmp/SeTtagext
  203.  
  204.    if [ "$MODE" = "HELP" ]; then
  205.     dialog --title "PROMPT MODE HELP" --textbox "/usr/lib/setup/PROMPThelp" 19 65
  206.    fi
  207.  
  208.    if [ "$MODE" = "Path" ]; then
  209.     dialog --title "PROVIDE A CUSTOM PATH TO YOUR TAGFILES" --inputbox "If \
  210. you're installing from CD-ROM, it's impossible to edit the tagfiles that are \
  211. in the package directories. In this case, you might want to provide a path to \
  212. your custom tagfiles. As an example, you could create a /tagfiles directory \
  213. and mount a floppy disk containing the tagfiles on that directory. Then you'd \
  214. enter '/tagfiles' at the prompt below. The setup program will look for your \
  215. tagfile in SUBDIRECTORIES of the path you provide, such as /tagfiles/a1, \
  216. /tagfiles/ap1, /tagfiles/d1, and so on. You only need to provide a \
  217. subdirectory and tagfile for the first disk of each series to be installed. \
  218. If a custom tagfile is not found at the path you provide, setup will revert to \
  219. the default tagfiles. Please enter the path to your custom tagfiles:" \
  220. 20 70 2> /tmp/SeTtagpath
  221.     if [ $? = 1 -o $? = 255 ]; then
  222.      continue
  223.     fi
  224.     if [ -r /tmp/SeTtagpath ]; then
  225.      if [ "`cat /tmp/SeTtagpath`" = "" ]; then
  226.       rm -f /tmp/SeTtagpath
  227.      fi
  228.     fi
  229.     break;
  230.    fi
  231.  
  232.    if [ "$MODE" = "Normal" ]; then 
  233.     break;
  234.    fi 
  235.  
  236.    if [ "$MODE" = "Custom" ]; then
  237.     dialog --title "ENTER CUSTOM EXTENSION" --inputbox "Now, enter the custom \
  238. extension you have used for your tagfiles. This must be a valid MS-DOS format \
  239. file extension consisting of a period followed by three characters. For \
  240. example, I use '.pat'. You might see my tagfiles on your disks. :^)" \
  241. 13 60 2> /tmp/SeTtagext
  242.     if [ $? = 1 -o $? = 255 ]; then
  243.      continue
  244.     fi
  245.     if [ -r /tmp/SeTtagext ]; then
  246.      if [ "`cat /tmp/SeTtagext`" = "" ]; then
  247.       rm -f /tmp/SeTtagext
  248.      fi
  249.     fi
  250.     break;
  251.    fi
  252.  
  253.    if [ "$MODE" = "None" ]; then
  254.     dialog --title "WARNING" --yesno "You should be advised that installing \
  255. *everything* is often a bad plan. If you're just putting the base system in \
  256. place and planning to install things like X and Emacs a little more \
  257. selectively from your hard drive later, then there's no problem. Otherwise, \
  258. if you try to install the whole thing without prompts you will not get as \
  259. optimal an installation as you might like. Are you sure you want to install \
  260. without prompts?" 13 60
  261.     if [ ! $? = 0 ]; then
  262.      continue
  263.     fi
  264.     IGNORE_TAGFILES="-ignore_tagfiles"
  265.     break;
  266.    fi
  267.  
  268.   done
  269.  
  270.   if [ "$IGNORE_TAGFILES" = "" ]; then
  271.    if [ "$QUICK" = "QUICK" ]; then
  272.     dialog --infobox "QUICK mode selected. Using menus for individual \
  273. package selection." 4 50
  274.    else 
  275.     dialog --infobox "PROMPT mode selected. Using prompting defaults \
  276. found in tagfiles along the way." 4 50
  277.    fi
  278.    sleep 3
  279.   else
  280.    IGNORE_TAGFILES="-ignore_tagfiles"
  281.    dialog --infobox "PROMPT mode not selected. Installing all the packages \
  282. on the selected disk sets." 4 50
  283.    sleep 3
  284.   fi
  285.   SOURCE_MOUNTED="`cat /tmp/SeTmount`"
  286.   DISTRIBUTION_SOURCE="`cat /tmp/SeTDS`"
  287.   if [ "$DISTRIBUTION_SOURCE" != "" ]; then
  288.    cpkgtool $SOURCE_MOUNTED $IGNORE_TAGFILES -source_device $SOURCE_DEVICE -source_dir $DISTRIBUTION_SOURCE -target_dir $T_PX $SERIES
  289.   else
  290.    cpkgtool $SOURCE_MOUNTED $IGNORE_TAGFILES -source_device $SOURCE_DEVICE -target_dir $T_PX $SERIES
  291.   fi
  292.   MAINSELECT="CONFIGURE"
  293.  fi
  294.  
  295.  if [ "$MAINSELECT" = "CONFIGURE" ]; then
  296.   SeTconfig
  297.   if [ -r /tmp/SeTnative ]; then
  298.    if [ -r /mnt/etc/fstab ]; then
  299.     dialog --title "REPLACE /etc/fstab?" --yesno "You already have an \
  300. /etc/fstab on your install partition. If you were just adding software, \
  301. you should probably keep your old /etc/fstab. If you've changed your \
  302. partitioning scheme, you should use the new /etc/fstab. Do you want \
  303. to replace your old /etc/fstab with the new one?" 10 60
  304.     if [ $? = 0 ]; then
  305.      cat /dev/null > /mnt/etc/fstab
  306.      if [ -r /tmp/SeTswap ]; then
  307.       cat /tmp/SeTswap > /mnt/etc/fstab
  308.      fi
  309.      cat /tmp/SeTnative >> /mnt/etc/fstab
  310.      # Mount up the CD-ROM if it exists...
  311.      if [ -r /tmp/SeTcdfstab ]; then
  312.       mkdir -p /mnt/cdrom
  313.       cat /tmp/SeTcdfstab >> /tmp/SeTDOS
  314.      fi
  315.      if [ -r /tmp/SeTDOS ]; then
  316.       cat /tmp/SeTDOS >> /mnt/etc/fstab
  317.      fi
  318.      echo "none             /proc    proc        defaults   1   1" >> /mnt/etc/fstab
  319.     fi
  320.    else # /mnt/etc/fstab not found
  321.     cat /dev/null > /mnt/etc/fstab
  322.     if [ -r /tmp/SeTswap ]; then
  323.      cat /tmp/SeTswap > /mnt/etc/fstab
  324.     fi
  325.     cat /tmp/SeTnative >> /mnt/etc/fstab
  326.     # Mount up the CD-ROM if it exists...
  327.     if [ -r /tmp/SeTcdfstab ]; then
  328.      mkdir -p /mnt/cdrom
  329.      cat /tmp/SeTcdfstab >> /tmp/SeTDOS
  330.     fi
  331.     if [ -r /tmp/SeTDOS ]; then
  332.      cat /tmp/SeTDOS >> /mnt/etc/fstab
  333.     fi
  334.     echo "none             /proc    proc        defaults   1   1" >> /mnt/etc/fstab
  335.    fi
  336.    dialog --title "SETUP COMPLETE" --msgbox "System configuration \
  337. is complete. You may EXIT setup and reboot your machine with \
  338. ctrl-alt-delete." 6 60
  339.   fi
  340.  fi
  341.  
  342.  if [ "$MAINSELECT" = "EXIT" ]; then
  343.   reset
  344.   break
  345.  fi
  346.  
  347. done # end of main loop
  348.  
  349. sync
  350. if mount | fgrep /var/adm/mount 1> /dev/null 2> /dev/null ; then
  351.  umount /var/adm/mount 
  352. fi
  353. rm -f /var/adm/mount 2> /dev/null
  354. rmdir /var/adm/mount 2> /dev/null
  355. mkdir /var/adm/mount 2> /dev/null
  356. chmod 755 /var/adm/mount
  357. chmod 755 $T_PX
  358. if [ -d $T_PX/tmp ]; then
  359.  chmod 1777 $T_PX/tmp
  360. fi
  361. rm -f /tmp/tagfile /tmp/SeT*
  362. # end slackware setup script
  363.