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