home *** CD-ROM | disk | FTP | other *** search
/ BUG 1 / BUGCD1996_0708.ISO / pc / util / minilin / minilin.exe / SBIN / SETUP.TTY < prev    next >
Text File  |  1994-05-20  |  50KB  |  1,562 lines

  1. #!/bin/sh
  2. #
  3. # Copyright 1993 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. # T_PX = target prefix, T_MT = target mounted
  26. print_list() {
  27. cat << EOF
  28.       A   - Base Linux system
  29.       AP  - Various applications that do not need X
  30.       D   - Program Development (C, C++, Kernel source, Lisp, Perl, etc.)
  31.       E   - GNU Emacs
  32.       F   - FAQ lists
  33.       I   - Info pages.
  34.       IV  - Interviews: libraries, include files, Doc and Idraw apps for X
  35.       M   - Mosaic: a World Wide Web reader for X.
  36.       N   - Networking (TCP/IP, UUCP, Mail)
  37.       Q   - Extra kernels with special drivers (needed for non-SCSI CD)
  38.       T   - TeX
  39.       TCL - Tcl/Tk/TclX, Tcl language, and Tk toolkit for developing X apps
  40.       OOP - Object Oriented Programming (GNU Smalltalk 1.1.1)
  41.       X   - XFree-86 2.1 Base X Window System
  42.       XAP - X Windows Applications
  43.       XD  - XFree-86 2.1 X11 server development system
  44.       XV  - XView 3.2 release 5. (OpenLook [virtual] Window Manager, apps)
  45.       Y   - Games (that do not require X)
  46. EOF
  47. }
  48. # 'probe()' borrowed from LILO QuickInst.
  49. probe()
  50. {
  51.  [ ! -z "`dd if=$1 bs=1 count=1 2>/dev/null | tr '\0' x`" ]
  52.  return
  53. }
  54. T_MT="n"
  55. ADDSOFT="n"
  56. if [ ! -L /usr/man ]; then # detect a *real* Linux system (are man pages there?)
  57.  T_PX="/"
  58.  ADDSOFT="a"
  59.  T_MT="y"
  60. else
  61.  T_PX="/mnt"
  62. fi
  63. if [ "$1" = "-target_mounted" -o "$2" = "-target_mounted" ]; then # the target partitions have been manually mounted
  64.  T_MT="y"
  65. fi
  66. if [ "$1" = "-ibm" -o "$2" = "-ibm" ]; then # Valuepoint
  67.  VP="true"
  68. else
  69.  VP="false"
  70. fi
  71. if [ "y" = "$T_MT" ]; then # target partitions have been manually mounted
  72.  if mount | fgrep /var/adm/mount 1> /dev/null 2> /dev/null ; then
  73.   umount /var/adm/mount
  74.  fi
  75.  if [ "$T_PX" = "/mnt" ]; then
  76.   cat << EOF
  77. You have used the '-target_mounted' flag. In order to proceed, you must
  78. have formatted all of your Linux partitions with mke2fs or mkxfs and
  79. mounted all of them beneath /mnt. You should also use mkswap on your swap
  80. swap partitions and use 'swapon' to activate them.
  81.  
  82. When run in this mode, 'setup' does not automatically create an /etc/fstab
  83. for you. When the installation completes, you must create an /etc/fstab
  84. before you reboot. (if you're not just adding software, in which case you
  85. already have an /etc/fstab)
  86.  
  87. Since your real /etc directory is mounted under /mnt, you'll want to
  88. say 'vi /mnt/etc/fstab' and not 'vi /etc/fstab', of course.
  89. EOF
  90.  fi
  91. else
  92.  if [ -d /mnt/etc -o -d /mnt/lost+found ]; then # nothing should be on /mnt here!
  93.   umount -a 1> /dev/null 2> /dev/null
  94.   mount /proc /proc -t proc
  95.  fi
  96. fi
  97. rm -f /var/adm/mount 2> /dev/null
  98. rmdir /var/adm/mount 2> /dev/null
  99. mkdir /var/adm/mount 2> /dev/null
  100. rm -f /fsta*
  101. SWAP_IN_USE="false"
  102. REFORM="a"
  103. echo
  104. echo "Welcome to Slackware Linux Setup (v. 2.0.0-tty)"
  105. while [ 0 ]; do 
  106.  if [ "$T_PX" = "/" ]; then # skip keyboard config if on HD.
  107.   echo
  108.   break;
  109.  fi
  110.  while [ 0 ]; do
  111.   cat << EOF
  112.  
  113. Linux supports many different keyboard configurations. If you are not
  114. using a US keyboard, you will probably want to remap your keyboard.
  115.  
  116. Would you like to remap your keyboard?
  117.  
  118. 1 - yes
  119. 2 - no
  120.  
  121. EOF
  122.   echo -n "Your choice (1/2)? "
  123.   read REPLY;
  124.   if [ "$REPLY" = "1" -o "$REPLY" = "2" ]; then
  125.    break;
  126.   fi
  127.  done
  128.  if [ "$REPLY" = "1" ]; then
  129.   echo
  130.   echo "Please select one of the following keyboard maps:"
  131.   echo
  132.   COUNT="1"
  133.   for mapname in /usr/lib/kbd/keytables/*gz; do
  134.    THISMAP="$COUNT -- `basename $mapname`                              "
  135.    THISMAP="`echo "$THISMAP" | cut -b1-38`"
  136.    FUN_RESULT="`expr $COUNT % 2`"
  137.    if [ "$FUN_RESULT" = "1" ]; then
  138.     echo -n "$THISMAP"
  139.    else
  140.     echo "$THISMAP"
  141.    fi
  142.    COUNT=`expr $COUNT + 1`
  143.   done
  144.   echo
  145.   echo
  146.   echo -n "Which keyboard map would you like (1 - `expr $COUNT - 1`)? "
  147.   read MAPNUM;
  148.   COUNT="1"
  149.   MAPNAME="garbage" # and then we look for the real one
  150.   for mapname in /usr/lib/kbd/keytables/*gz; do
  151.    if [ "$COUNT" = "$MAPNUM" ]; then
  152.     MAPNAME=`basename $mapname`
  153.    fi
  154.    COUNT=`expr $COUNT + 1`
  155.   done
  156.   if [ ! -r /usr/lib/kbd/keytables/$MAPNAME ]; then 
  157.    cat << EOF
  158.  
  159.  Hey you! Follow the rules!
  160.  Going back...
  161. EOF
  162.    continue;
  163.   else
  164.    rm -rf /tmp/keymap
  165.    mkdir /tmp/keymap
  166.    rm -f /usr/lib/kbd/keytables/keytemp/* 
  167.    cp /usr/lib/kbd/keytables/$MAPNAME /tmp/keymap
  168.    gzip -d /tmp/keymap/*.gz
  169.    FULLNAME=`ls /tmp/keymap/*.map`
  170.    SHORTNAME=`basename $FULLNAME`
  171.    echo
  172.    echo "Installing keyboard map '$SHORTNAME'..."
  173.    echo
  174.    loadkeys $FULLNAME
  175.    cat << EOF
  176. OK, the new map is now installed. You may now test it by typing
  177. anything you want. To quit testing the keyboard, enter [y] on a
  178. line by itself to accept the map and go on, or [n] on a line by
  179. itself to reject the current keyboard map and select a new one.
  180.  
  181. EOF
  182.    while [ 0 ]; do
  183.     echo -n "test keyboard, or [n], or [y] => "
  184.     read REPLY;
  185.     if [ "$REPLY" = "n" -o "$REPLY" = "y" ]; then
  186.      break;
  187.     fi
  188.    done
  189.    if [ "$REPLY" = "y" ]; then
  190.     REMAPPING_DONE="true"
  191.     break;
  192.    else
  193.     continue;
  194.    fi
  195.   fi # if map is readable
  196.  else
  197.   # No remapping done
  198.   break;
  199.  fi
  200. done
  201. if [ "y" = "$T_MT" -a "$T_PX" = "/mnt" ]; then
  202.  while [ 0 ]; do
  203.   echo
  204.   echo "Are you installing Linux from scratch, or adding software to an existing"
  205.   echo "system? "
  206.   echo
  207.   echo -n "[I]nstall from scratch, or [a]dd? "
  208.   read ADDSOFT;
  209.   if [ "$ADDSOFT" = "a" -o "$ADDSOFT" = "i" ]; then
  210.    break;
  211.   fi
  212.  done
  213. fi
  214. PARTLIST="`fdisk -l | fgrep "Linux native"`"
  215. if [ "y" = "$T_MT" ]; then
  216.  PARTLIST="BOGUS" # A wonderful example of unstructured programming
  217. fi
  218. if [ ! "$PARTLIST" = "" ]; then
  219.  if [ ! "$PARTLIST" = "BOGUS" ]; then
  220.   SWAPLIST="`fdisk -l | fgrep "Linux swap"`" 
  221.   if [ "$SWAPLIST" = "" ]; then
  222.    echo 
  223.    echo "You have not created a swap partition with Linux fdisk."
  224.    echo -n "Do you want to continue without a swapfile ([y]es, [n]o)? "
  225.    read REPLY;
  226.    if [ "$REPLY" = "n" -o "$REPLY" = "N" ]; then
  227.     echo 
  228.     echo "Create a swapfile with Linux fdisk, and then run setup again."
  229.     echo 
  230.     exit;
  231.    fi
  232.   else
  233.    echo  
  234.    if [ "`echo "$SWAPLIST" | sed -n '2 p'`" = "" ]; then
  235.     echo "Slackware Setup has detected a swap partition:"
  236.     echo "`echo "$SWAPLIST" | sed -n '1 p'`"
  237.     echo 
  238.     echo -n "Do you wish to install this partition as your swapspace ([y]es, [n]o)? "
  239.    else
  240.     echo "Slackware Setup has detected the following swap partitions:"
  241.     echo "$SWAPLIST" 
  242.     echo
  243.     echo -n "Do you wish to install these as your swap partitions ([y]es, [n]o)? "
  244.    fi
  245.    read REPLY;
  246.    if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then
  247.     cat << EOF
  248.  
  249. IMPORTANT NOTE: If you have already made any of your swap partitions
  250. active (using the swapon command), then you should not allow setup to
  251. use mkswap on your swap partitions, because it may corrupt memory pages
  252. that are currently swapped out. Instead, you will have to make sure that
  253. your swap partitions have been prepared (with mkswap) before they will
  254. work. You might want to do this to any inactive swap partitions before
  255. you reboot.
  256.  
  257. EOF
  258.     echo -n "Do you want setup to use mkswap on your swap partitions ([y]es, [n]o)? "  
  259.     read USE_SWAP;
  260.     echo
  261.     rm -f /fstab.swap
  262.     rm -f $T_PX/fstab
  263.     CURRENT_SWAP="1" 
  264.     while [ ! "`echo "$SWAPLIST" | sed -n "$CURRENT_SWAP p"`" = "" ]; do 
  265.      echo "Setting up swapspace..."
  266.      SWAP_SIZE="`fdisk -l | fgrep "Linux swap" | sed -n "$CURRENT_SWAP p" | cut -b38-45`"
  267.      SWAP_PART="`fdisk -l | fgrep "Linux swap" | sed -n "$CURRENT_SWAP p" | cut -b1-10`"
  268.      if [ "$USE_SWAP" = "Y" -o "$USE_SWAP" = "y" ]; then 
  269.       mkswap $SWAP_PART $SWAP_SIZE
  270.      fi
  271.      swapon $SWAP_PART
  272.      echo "Adding this line to /etc/fstab:"
  273.      SWAP_IN_USE="`echo "$SWAP_PART       swap        swap        defaults"`"
  274.      echo "$SWAP_IN_USE"
  275.      echo "$SWAP_IN_USE" >> /fstab.swap
  276.      echo "Swapspace configured."
  277.      CURRENT_SWAP="`expr $CURRENT_SWAP + 1`"
  278.     done
  279.    fi
  280.   fi  
  281.   echo 
  282.   if [ ! "`echo "$PARTLIST" | sed -n '2 p'`" = "" ]; then # more than one:
  283.    echo "The following partitions on your machine are available for Linux:"
  284.    ONLY_ONE="false"
  285.   else
  286.    echo "The following partition is available for Linux:"
  287.    ONLY_ONE="true"
  288.   fi
  289.   echo 
  290.   echo "   Device Boot  Begin   Start     End  Blocks   Id  System"
  291.   fdisk -l | fgrep "Linux native"
  292.   while [ 0 ]; do 
  293.    if [ "$ONLY_ONE" = "false" ]; then
  294.     echo
  295.     echo -n "Which device would you like to use for your root Linux partition? "
  296.     read ROOT_DEVICE;
  297.    else
  298.     ROOT_DEVICE="`echo "$PARTLIST" | cut -b1-10`"
  299.    fi
  300.    echo 
  301.    if [ ! -b $ROOT_DEVICE ]; then
  302.     echo "Invalid device. Try again. Use a format such as:"
  303.     echo "/dev/hda3 or whatever the device name is."
  304.     continue;
  305.    fi
  306.    if fdisk -l | fgrep "Linux native" | fgrep $ROOT_DEVICE 1> /dev/null 2> /dev/null ; then
  307.     ROOT_SIZE="`fdisk -l | fgrep "$ROOT_DEVICE" | cut -b38-45`"
  308.     cat << EOF
  309. If this is the root partition of an existing Linux system, you
  310. may add more software to the existing system, or you may
  311. reformat the partition and install from scratch.
  312.  
  313. EOF
  314.     echo -n "Would you like to [a]dd more software, or [i]nstall from scratch? "
  315.     read ADDSOFT;
  316.     while [ 0 ]; do
  317.      cat << EOF
  318.  
  319. There are two main filesystem types that are used for Linux. These are
  320. the xiafs filesystem, and the second extended filesystem (ext2).
  321. If you are adding software to a system that has already been installed,
  322. you must enter the filesystem type it currently uses. If you're installing
  323. to a new system, you can try either filesystem type.
  324.  
  325. Which of these two filesystems to use is one of those things that some
  326. Linux users like to argue about needlessly. Both are good filesystems, and
  327. it's hard to say whether either one has a significant speed or reliability
  328. advantage. Ext2 does have one nice feature that xiafs doesn't have yet -
  329. as an ext2 partition is unmounted, a clean bit is written to it. When the
  330. machine is rebooted, checking is skipped for any partitions that have the
  331. clean bit on them. For this reason, ext2 systems boot faster than xiafs
  332. systems, unless you disable the automatic filesystem checking in /etc/rc.d/rc.S.
  333. If you use xiafs for your root partition, you'll see some warnings when you
  334. shut the system down. These are harmless and can be ignored.
  335.  
  336. What filesystem do you have (or do you plan to use) on your root
  337. EOF
  338.      echo -n "partition ($ROOT_DEVICE), [e]xt2fs or [x]iafs? "
  339.      read ROOT_SYS_TYPE; 
  340.      if [ "$ROOT_SYS_TYPE" = "e" ]; then
  341.       ROOT_SYS_TYPE="ext2"
  342.       break;
  343.      elif [ "$ROOT_SYS_TYPE" = "x" ]; then
  344.       ROOT_SYS_TYPE="xiafs"
  345.       break;
  346.      fi
  347.     done
  348.     while [ 0 ]; do
  349.      if [ "$ADDSOFT" = "a" ]; then
  350.       echo
  351.       echo "Software will be added to your system without reformatting your"
  352.       echo "partitions. "
  353.       echo
  354.       echo "Mounting your root partition..."
  355.       mount -t $ROOT_SYS_TYPE $ROOT_DEVICE /mnt
  356.       if [ ! -r $T_PX/etc/fstab ]; then
  357.        echo
  358.        echo "Either you have specified the wrong filesystem type, or there"
  359.        echo "is no Linux system currently installed on the partition."
  360.        echo  
  361.        echo "Sorry, but you'll have to try again." 
  362.        exit;
  363.       fi
  364.       echo "Scanning your /etc/fstab..."
  365.       echo
  366.       index="0"
  367.       while [ 0 ]; do
  368.               index="`expr $index + 1`"
  369.        THISLINE="`cat $T_PX/etc/fstab | tr "[\011]" "[\040]" | sed -n "$index p"`"
  370.               BLANKCHECK="`echo $THISLINE | sed 's/ //g'`"
  371.               if [ "$BLANKCHECK" = "" ]; then
  372.                       break;
  373.               fi
  374.               if echo "$THISLINE" | fgrep ext2 1> /dev/null 2> /dev/null ; then
  375.                       ADD_TYPE="ext2"
  376.        elif echo "$THISLINE" | fgrep xiafs 1> /dev/null 2> /dev/null ; then
  377.         ADD_TYPE="xiafs"
  378.               else
  379.                       continue;
  380.               fi
  381.        NEWPART="`echo "$THISLINE" | cut -b1-10`"
  382.        THISLINE="`echo "$THISLINE" | cut -b11-`"
  383.        while [ 0 ]; do
  384.         FIRST="`echo "$THISLINE" | cut -b1`"
  385.         if [ "$FIRST" = "/" ]; then
  386.          break;
  387.         fi
  388.         THISLINE="`echo "$THISLINE" | cut -b2-`"
  389.        done
  390.        SECOND="`echo "$THISLINE" | cut -b2`" 
  391.        if [ "$SECOND" = " " ]; then
  392.         # We don't want to remount the / partition
  393.         continue;
  394.        fi
  395.        end_of_line="1"
  396.        while [ 0 ]; do
  397.         end_of_line="`expr $end_of_line + 1`"
  398.         if [ "`echo "$THISLINE" | cut -b$end_of_line`" = " " -o "`echo "$THISLINE" | cut -b$end_of_line`" = "" -o "`echo "$THISLINE" | cut -b$end_of_line`" = "fucking tab character" ]; then
  399.          # Found it!
  400.                 end_of_line="`expr $end_of_line - 1`"
  401.          break;
  402.         fi
  403.        done
  404.        MNTDIR="`echo "$THISLINE" | cut -b1-$end_of_line`"
  405.        echo "Mounting $NEWPART under $T_PX$MNTDIR as type $ADD_TYPE..."
  406.        mount -t $ADD_TYPE $NEWPART $T_PX$MNTDIR
  407.       done
  408.       break;
  409.      else
  410.       cat << EOF
  411.  
  412. Since you've chosen to install Linux from scratch, we want to be
  413. sure you know how to proceed, and we also want to give you one last
  414. chance to change your mind. When using this option, you must install
  415. to a blank partition. If you have not already formatted it manually
  416. then you must format it when prompted.
  417.  
  418. Enter [i] again to install from scratch, or [a] to add
  419. software to your existing system.
  420.  
  421. EOF
  422.       echo -n "Install fresh, or add software to your current system? ([i]nstall, [a]dd)? "
  423.       read REFORM;
  424.       if [ "$REFORM" = "i" ]; then
  425.        echo
  426.        echo "If this partition has not been formatted, you should format it."
  427.        echo
  428.        break;
  429.       else
  430.        ADDSOFT="a"
  431.       fi
  432.      fi           
  433.     done
  434.     if [ ! "$ADDSOFT" = "a" ]; then
  435.      echo -n "Would you like to format this partition ([y]es, [n]o, [c]heck sectors too)? "
  436.      read DOFORMAT;
  437.      echo
  438.      if [ "$DOFORMAT" = "Y" -o "$DOFORMAT" = "y" -o "$DOFORMAT" = "c" ]; then
  439.       echo "Attempting to unmount $ROOT_DEVICE..."
  440.       umount $ROOT_DEVICE 
  441.       echo "Formatting $ROOT_DEVICE ($ROOT_SIZE blocks) as type $ROOT_SYS_TYPE..."
  442.       if [ "$ROOT_SYS_TYPE" = "ext2" ]; then
  443.        if [ "$DOFORMAT" = "c" ]; then
  444.         mke2fs -c $ROOT_DEVICE $ROOT_SIZE
  445.        else
  446.         mke2fs $ROOT_DEVICE $ROOT_SIZE
  447.        fi
  448.       else
  449.        if [ "$DOFORMAT" = "c" ]; then
  450.         mkxfs -c $ROOT_DEVICE $ROOT_SIZE
  451.        else
  452.         mkxfs $ROOT_DEVICE $ROOT_SIZE
  453.        fi
  454.       fi
  455.       echo "Done formatting device $ROOT_DEVICE."
  456.      fi
  457.      echo "Mounting your new root partition:"
  458.      mount -t $ROOT_SYS_TYPE $ROOT_DEVICE $T_PX 1> /dev/null 2> /dev/null
  459.      if [ ! -d $T_PX/tmp ]; then
  460.       mkdir $T_PX/tmp
  461.       chmod 1777 $T_PX/tmp
  462.      fi
  463.      echo "Root partition mounted."
  464.      if [ ! "$SWAP_IN_USE" = "false" ]; then
  465.       cat /fstab.swap >> $T_PX/fstab
  466.      fi
  467.      echo "$ROOT_DEVICE       /        $ROOT_SYS_TYPE        defaults" >> $T_PX/fstab 
  468.      break;
  469.     fi
  470.    else # device not tagged Linux native
  471.     echo "The partition you have selected is not tagged as Linux"
  472.     echo "native. Either select a new partition, or tag the selected"
  473.     echo "one with Linux fdisk." 
  474.     continue;
  475.    fi
  476.    break;
  477.   done # mounting the target root partition
  478.   if [ ! "$ADDSOFT" = "a" ]; then
  479.    # Now, if the user wants to mount some other partitions for /usr or
  480.    # /usr/X11 or whatever (/tmp, you name it), Here's where we do that
  481.    echo 
  482.    if [ ! "`echo "$PARTLIST" | sed -n '2 p'`" = "" ]; then
  483.     cat << EOF
  484. You seem to have more than one partition tagged as Linux native.
  485. You may use these to distribute your Linux system across more than
  486. one partition. Currently, you have $ROOT_DEVICE mounted as your /
  487. partition. You might want to mount large directories such as /usr
  488. or /usr/X11 or seperate partitions. You should not try to mount
  489. /etc or /bin on their own partitions since they contain utilities
  490. needed to bring the system up and mount partitions.
  491.  
  492. Would you like to use some of the other Linux partitions
  493. EOF
  494.     echo -n "to mount some of your directories ([y]es, [n]o)? "
  495.     read MOUNTMORE;
  496.     if [ "$MOUNTMORE" = "y" -o "$MOUNTMORE" = "Y" ]; then
  497.      while [ 0 ]; do
  498.       echo 
  499.       echo "These are your Linux partitions:"
  500.       echo "$PARTLIST" 
  501.       echo 
  502.       echo "These partitions are already in use:"
  503.       mount | fgrep mnt
  504.       echo 
  505.       echo "Please enter the partition you would like to use, or"
  506.       echo -n "type <q> to quit adding new partitions: " 
  507.       read NEXT_PARTITION;
  508.       if [ "$NEXT_PARTITION" = "q" ]; then
  509.        break;
  510.       fi
  511.       if [ ! -b $NEXT_PARTITION ]; then
  512.        echo
  513.        echo "Invalid device. Try again. Use a format such as:"
  514.        echo "/dev/hda3 or whatever the device name is."
  515.        continue;
  516.       else
  517.        if fdisk -l | fgrep "Linux native" | fgrep $NEXT_PARTITION 1> /dev/null 2> /dev/null ; then
  518.         NEXT_SIZE="`fdisk -l | fgrep "$NEXT_PARTITION" | cut -b38-45`"
  519.         while [ 0 ]; do
  520.          echo 
  521.          echo -n "What type of filesystem would you like to use ([e]xt2fs, [x]iafs)? " 
  522.          read NEXT_SYS_TYPE;
  523.          if [ "$NEXT_SYS_TYPE" = "x" ]; then
  524.           NEXT_SYS_TYPE="xiafs"
  525.           break;
  526.          elif [ "$NEXT_SYS_TYPE" = "e" ]; then
  527.           NEXT_SYS_TYPE="ext2"
  528.           break;
  529.          fi
  530.         done
  531.         echo
  532.         echo -n "Would you like to format this partition ([y]es, [n]o, [c]heck sectors too)? "
  533.         read DOFORMAT;
  534.         if [ "$DOFORMAT" = "Y" -o "$DOFORMAT" = "y" -o "$DOFORMAT" = "c" ]; then
  535.          echo "Formatting $NEXT_PARTITION ($NEXT_SIZE blocks) as Linux $NEXT_SYS_TYPE..."
  536.          if [ "$NEXT_SYS_TYPE" = "ext2" ]; then
  537.           if [ "$DOFORMAT" = "c" ]; then
  538.            mke2fs -c $NEXT_PARTITION $NEXT_SIZE
  539.           else
  540.            mke2fs $NEXT_PARTITION $NEXT_SIZE
  541.           fi
  542.          else
  543.           if [ "$DOFORMAT" = "c" ]; then
  544.            mkxfs -c $NEXT_PARTITION $NEXT_SIZE
  545.           else
  546.            mkxfs $NEXT_PARTITION $NEXT_SIZE
  547.           fi
  548.          fi
  549.          echo "Done formatting device $NEXT_PARTITION."
  550.         fi
  551.         echo 
  552.         echo "Now this new partition must be mounted somewhere in your new"
  553.         echo "directory tree. For example, if you want to put it under /usr/X11,"
  554.         echo "then respond: /usr/X11"
  555.         echo 
  556.         echo -n "Where would you like to mount $NEXT_PARTITION? "
  557.         read NEW_DIRECTORY;
  558.         echo "Mounting device $NEXT_PARTITION under $NEW_DIRECTORY on your root device:"
  559.         mkdir -p /mnt$NEW_DIRECTORY
  560.         chmod 755 /mnt$NEW_DIRECTORY
  561.         mount -t $NEXT_SYS_TYPE $NEXT_PARTITION /mnt$NEW_DIRECTORY 1> /dev/null 2> /dev/null
  562.         echo "Partition $NEXT_PARTITION mounted."
  563.         echo "$NEXT_PARTITION        $NEW_DIRECTORY        $NEXT_SYS_TYPE        defaults" >> /mnt/fstab 
  564.         echo 
  565.         echo -n "Would you like to mount some more additional partitions ([y]es, [n]o)? "
  566.         read REPLY;
  567.         if [ "$REPLY" = "n" -o "$REPLY" = "N" ]; then
  568.          break;
  569.         fi
  570.        else # device not tagged Linux native
  571.         echo "The partition you have selected is not tagged as Linux"
  572.         echo "native. Either select a new partition, or tag the selected"
  573.         echo "one with Linux fdisk." 
  574.         continue;
  575.        fi
  576.       fi
  577.      done # mounting additional partitions
  578.      echo
  579.     fi
  580.    else
  581.     echo "Installing all software on $ROOT_DEVICE."
  582.     echo 
  583.    fi # end of target partition setup
  584.    # Add DOS partitions.
  585.    DOSLIST="`fdisk -l | fgrep "DOS"`"
  586.    HPFSLIST="`fdisk -l | fgrep "HPFS"`"
  587.    if [ ! "$HPFSLIST" = "" ]; then
  588.     DOSLIST="`echo -e "$DOSLIST\n$HPFSLIST"`"
  589.    fi
  590.    if [ ! "$DOSLIST" = "" ]; then # there are DOS or OS/2 partitions:
  591.     cat << EOF
  592. DOS AND OS/2 PARTITION SETUP
  593.  
  594. The following DOS FAT or OS/2 HPFS partitions were found:
  595.  
  596. $DOSLIST
  597.  
  598. Would you like to set up some of these partitions to be visible
  599. EOF
  600.     echo -n "from Linux ([y]es, [n]o)? "
  601.     read ADDDOS;
  602.     if [ "$ADDDOS" = "y" -o "$ADDDOS" = "Y" ]; then
  603.      while [ 0 ]; do
  604.       USED_DOS_PARTITIONS="`cat /mnt/fstab | fgrep msdos`"
  605.       USED_HPFS_PARTITIONS="`cat /mnt/fstab | fgrep hpfs`"
  606.       if [ ! "$USED_HPFS_PARTITIONS" = "" ]; then
  607.        USED_DOS_PARTITIONS="`echo -e "$USED_DOS_PARTITIONS\n$USED_HPFS_PARTITIONS"`"
  608.       fi
  609.       if [ ! "$USED_DOS_PARTITIONS" = "" ]; then
  610.        echo
  611.        echo "These DOS or OS/2 partitions have already been added"
  612.        echo "to your /etc/fstab:"
  613.        echo "$USED_DOS_PARTITIONS"
  614.       fi
  615.       echo 
  616.       echo "These DOS or OS/2 partitions are available to mount:"
  617.       echo "$DOSLIST" 
  618.       echo 
  619.       echo "Please enter the partition you would like to access from Linux, or"
  620.       echo -n "type <q> to quit adding new partitions: " 
  621.       read NEXT_PARTITION;
  622.       echo 
  623.       if [ "$NEXT_PARTITION" = "q" ]; then
  624.        break;
  625.       fi
  626.       if [ ! -b $NEXT_PARTITION ]; then
  627.        echo "Invalid device. Try again. Use a format such as:"
  628.        echo "/dev/hda3 or whatever the device name is."
  629.        continue;
  630.       else
  631.        if echo "$DOSLIST" | fgrep $NEXT_PARTITION 1> /dev/null 2> /dev/null ; then
  632.         # Here we should test to be sure the partition has not been used
  633.         if fgrep $NEXT_PARTITION /mnt/fstab 1> /dev/null 2> /dev/null ; then
  634.          # We have already added this partition.
  635.          echo "Sorry, you have already added the partition $NEXT_DEVICE to the"
  636.          echo "list of devices that are mounted at boot time. Either choose a"
  637.          echo "partition you have not yet used, or [q]uit to go on."
  638.          continue;
  639.         fi
  640.         echo "Now this new partition must be mounted somewhere in your directory"
  641.         echo "tree. Please enter the directory under which you would like to put"
  642.         echo "it. for instance, you might want to reply /dosc, /dosd, or something"
  643.         echo "like that."
  644.         echo
  645.         echo -n "Where would you like to mount $NEXT_PARTITION? "
  646.         read NEW_DIR;
  647.     if [ ! "`echo $NEW_DIR | cut -b1`" = "/" ]; then
  648.          NEW_DIR="/$NEW_DIR"
  649.         fi
  650.         echo 
  651.         echo "Creating mount point directory..."
  652.         mkdir -p /mnt$NEW_DIR
  653.         echo "Setting directory permissions..."
  654.         chmod 755 /mnt$NEW_DIR
  655.         if fdisk -l | fgrep "DOS" | fgrep $NEXT_PARTITION 1> /dev/null 2> /dev/null ; then
  656.          echo "Adding DOS partition to /etc/fstab..."
  657.          echo "$NEXT_PARTITION        $NEW_DIR        msdos        defaults" >> /mnt/fstab 
  658.         else
  659.          echo "Adding HPFS partition (read only) to /etc/fstab..."
  660.          echo "$NEXT_PARTITION        $NEW_DIR        hpfs         ro" >> /mnt/fstab 
  661.         fi
  662.         echo "Done adding partition $NEXT_PARTITION."
  663.        else # device not tagged as DOS
  664.         echo "The partition you have selected is not tagged as a DOS or OS/2"
  665.         echo "partition, please try again."
  666.         continue;
  667.        fi
  668.       fi
  669.      done # mounting DOS/HPFS partitions
  670.     fi
  671.    fi
  672.   fi # ! just adding stuff
  673.  fi # PARTLIST != BOGUS (for T_MT)
  674.  DISTRIBUTION_SOURCE="/var/adm/mount"
  675.  SOURCE_DEVICE="/dev/fd0"
  676.  if [ "$T_PX" = "/" ]; then
  677.   echo -n "Would you like to install more software ([y]es, [n]o)? "
  678.   read INSFT;
  679.  fi
  680.  if [ "$INSFT" = "y" -o ! "$T_PX" = "/" ]; then
  681.   cat << EOF
  682.  
  683. SOURCE MEDIA SELECTION
  684.  
  685. 1 -- Install from a hard drive partition.
  686. 2 -- Install from floppy disks.
  687. 3 -- Install via NFS.
  688. 4 -- Install from a pre-mounted directory.
  689. 5 -- Install from CD-ROM.
  690.  
  691. EOF
  692.   echo -n "From which source will you be installing Linux (1/2/3/4/5)? "
  693.   read SOURCE_MEDIA;
  694.   echo 
  695.   if [ "$SOURCE_MEDIA" = "1" ]; then
  696.    cat << EOF
  697. INSTALLING FROM HARD DISK
  698.  
  699. In order to install directly from the hard disk you must have a partition with
  700. a directory containing the Slackware distribution such that each disk other than
  701. the boot disk is contained in a subdirectory. For example, if the distribution 
  702. is in /stuff/slack, then you have to have directories named /stuff/slack/a1, 
  703. /stuff/slack/a2, and so on each containing the files that would be on that disk.
  704. You may install from DOS, HPFS, or Linux partitions.
  705.  
  706. EOF
  707.    while [ 0 ]; do
  708.     echo "Please enter the partition where the Slackware sources can be"
  709.     echo -n "found, or [p] to see a partition list: "
  710.     read SLACK_DEVICE;
  711.     echo 
  712.     if [ "$SLACK_DEVICE" = "p" -o "$SLACK_DEVICE" = "P" ]; then
  713.      echo "Here are your partitions:"
  714.      echo
  715.      fdisk -l | fgrep "/dev"
  716.      echo
  717.      continue;
  718.     fi
  719.     break;
  720.    done
  721.    cat << EOF
  722. Now we need to know what directory on this partition the Slackware sources
  723. can be found in. In the example above, this would be: /stuff/slack
  724.  
  725. NOTE: You must give the directory name relative to the top of the partition.
  726. So, for example, if you're going to mount this partition under /usr, don't
  727. include the '/usr' at the beginning of the pathname.
  728.  
  729. EOF
  730.    echo -n "What directory are the Slackware sources in? "
  731.    read SLACK_SOURCE_LOCATION;
  732.    echo
  733.    if mount | fgrep $SLACK_DEVICE 1> /dev/null 2> /dev/null ; then
  734.     # This partition is already mounted, so we will have to
  735.     # tweak things funny.
  736.     rm -f /var/adm/mount 2> /dev/null
  737.     rmdir /var/adm/mount 2> /dev/null
  738.     PREFIX="`mount | fgrep $SLACK_DEVICE`"
  739.     PREFIX="`echo "$PREFIX" | cut -b14-`"
  740.     end_of_line="1"
  741.     while [ 0 ]; do
  742.      end_of_line="`expr $end_of_line + 1`"
  743.      if [ "`echo "$PREFIX" | cut -b$end_of_line`" = " " ]; then  # Found it!
  744.       end_of_line="`expr $end_of_line - 1`"
  745.       break;
  746.      fi
  747.     done
  748.     PREFIX="`echo "$PREFIX" | cut -b1-$end_of_line`"
  749.     ln -sf $PREFIX /var/adm/mount 
  750.    else
  751.     while [ 0 ]; do
  752.      cat << EOF
  753. What type of filesystem does your Slackware source partition contain?
  754.  
  755. 1 - FAT (MS-DOS, DR-DOS, OS/2)
  756. 2 - Linux Second Extended Filesystem
  757. 3 - Linux Xiafs
  758. 4 - Linux MINIX
  759. 5 - OS/2 HPFS
  760.  
  761. EOF
  762.      echo -n "Filesystem (1,2,3,4,5)? "
  763.      read FILESYS;
  764.      if [ "$FILESYS" = "1" ]; then 
  765.       SLACK_FS_TYPE="msdos"
  766.       break;
  767.      elif [ "$FILESYS" = "2" ]; then 
  768.       SLACK_FS_TYPE="ext2"
  769.       break;
  770.      elif [ "$FILESYS" = "3" ]; then 
  771.       SLACK_FS_TYPE="xiafs"
  772.       break;
  773.      elif [ "$FILESYS" = "4" ]; then 
  774.       SLACK_FS_TYPE="minix"
  775.       break;
  776.      elif [ "$FILESYS" = "5" ]; then 
  777.       SLACK_FS_TYPE="hpfs"
  778.       break;
  779.      fi
  780.     done
  781.     if [ "$FILESYS" = "5" ]; then
  782.      mount -o ro -t $SLACK_FS_TYPE $SLACK_DEVICE /var/adm/mount
  783.     else
  784.      mount -t $SLACK_FS_TYPE $SLACK_DEVICE /var/adm/mount
  785.     fi
  786.     if [ ! $? = 0 ]; then # there was a mount error
  787.      cat << EOF
  788.  
  789. There was a problem mounting your partition. Would you like to:
  790.  
  791. 1 -- Abort 'setup'.
  792. 2 -- Ignore the error and continue.
  793.  
  794. EOF
  795.      echo -n "Which (1/2)? "
  796.      read DOWHAT;
  797.      if [ $DOWHAT = 1 ]; then
  798.       echo
  799.       echo "Aborting..."
  800.       exit;
  801.      fi
  802.      echo
  803.     fi # mount error
  804.    fi
  805.    echo 
  806.    if [ -d /var/adm/mount/$SLACK_SOURCE_LOCATION ]; then
  807.     DISTRIBUTION_SOURCE=/var/adm/mount/$SLACK_SOURCE_LOCATION
  808.    else
  809.     cat << EOF
  810.  
  811. Sorry, but the directory $SLACK_SOURCE_LOCATION does not exist
  812. on partition $SLACK_DEVICE.
  813.  
  814. Aborting installation...
  815.  
  816. EOF
  817.     exit
  818.    fi
  819.    SOURCE_MOUNTED="-source_mounted"
  820.   elif [ "$SOURCE_MEDIA" = "4" ]; then
  821.    cat << EOF
  822.  
  823. OK, we will install from a directory that is currently mounted. This can be
  824. mounted normally or through NFS. You need to specify the name of the directory
  825. that contains the subdirectories for each source disk.
  826.  
  827. EOF
  828.    echo -n "Which directory would you like to install from? "
  829.    read SOURCEDIR;
  830.    rm -f /var/adm/mount 2> /dev/null
  831.    rmdir /var/adm/mount 2> /dev/null
  832.    ln -sf $SOURCEDIR /var/adm/mount
  833.    if [ -d $SOURCEDIR ]; then
  834.     DISTRIBUTION_SOURCE=/var/adm/mount
  835.    else
  836.     cat << EOF
  837.  
  838. Sorry - the directory you specified is not valid. Please check the directory
  839. and try again.
  840.  
  841. Aborting installation...
  842.  
  843. EOF
  844.     exit 1;
  845.    fi
  846.    SOURCE_MOUNTED="-source_mounted"
  847.   elif [ "$SOURCE_MEDIA" = "2" ]; then
  848.    cat << EOF
  849.  
  850. The base Slackware series (A) can be installed from 1.2M or 1.44M media. 
  851. Most of the other disks will not fit on 1.2M media, but can be downloaded
  852. to your hard drive and installed from there later.
  853.  
  854. 1 - /dev/fd0H1440 (1.44M drive a:)
  855. 2 - /dev/fd1H1440 (1.44M drive b:)
  856. 3 - /dev/fd0h1200 (1.2M drive a:)
  857. 4 - /dev/fd1h1200 (1.2M drive b:)
  858. EOF
  859.    while [ 0 ]; do
  860.     echo
  861.     echo -n "Which drive would you like to install from (1/2/3/4)? "
  862.     read WHICH_DRIVE;
  863.     echo
  864.     if [ "$WHICH_DRIVE" = "1" ]; then
  865.      SOURCE_DEVICE="/dev/fd0H1440"
  866.      break;
  867.     elif [ "$WHICH_DRIVE" = "2" ]; then
  868.      SOURCE_DEVICE="/dev/fd1H1440"
  869.      break;
  870.     elif [ "$WHICH_DRIVE" = "3" ]; then
  871.      SOURCE_DEVICE="/dev/fd0h1200"
  872.      break;
  873.     elif [ "$WHICH_DRIVE" = "4" ]; then
  874.      SOURCE_DEVICE="/dev/fd1h1200"
  875.      break;
  876.     fi
  877.    done 
  878.   elif [ "$SOURCE_MEDIA" = "3" ]; then
  879.    cat << EOF
  880.  
  881. NFS INSTALLATION
  882.  
  883. We need to know a few things before going on...
  884.  
  885. EOF
  886.    if [ "$T_PX" = "/" ]; then
  887.     echo "You're running off the hard drive filesystem. Is this machine"
  888.     echo "currently running on the network you plan to install from? If"
  889.     echo "so, we won't try to reconfigure your ethernet card."
  890.     echo 
  891.     echo -n "Are you up-and-running on the network ([y]es, [n]o)? "
  892.     read UPNRUN;
  893.     echo
  894.    fi
  895.    if [ ! "$UPNRUN" = "y" ]; then
  896.     cat << EOF
  897. You will need to enter the IP address you wish to
  898. assign to this machine. Example: 111.112.113.114
  899.  
  900. EOF
  901.     echo -n "What is your IP address? "
  902.     read LOCAL_IPADDR;
  903.     cat << EOF
  904.  
  905. Now we need to know your netmask.
  906. Typically this will be 255.255.255.0
  907.  
  908. EOF
  909.     echo -n "What is your netmask? "
  910.     read LOCAL_NETMASK;
  911.     cat << EOF
  912.  
  913. Typically your broadcast address will be the same as
  914. your IP address with 255 replacing the final value.
  915. Example: 111.112.113.255
  916.  
  917. EOF
  918.     echo -n "What is your broadcast address? "
  919.     read LOCAL_BROADCAST;
  920.     cat << EOF
  921.  
  922. Now we need your network address.
  923.  
  924. Your network address will usually be the same as your IP
  925. address, with the last value replaced by 0.
  926. For example: 111.112.113.0
  927.  
  928. EOF
  929.     echo -n "What is your network address? "
  930.     read LOCAL_NETWORK;
  931.     echo 
  932.     echo -n "Do you have a gateway (y/n)? "
  933.     read HAVE_GATEWAY;
  934.     echo 
  935.     if [ "$HAVE_GATEWAY" = "y" ]; then
  936.      echo 
  937.      echo -n "What is your gateway address? "
  938.      read LOCAL_GATEWAY;  
  939.     fi
  940.    fi # ! UPNRUN
  941.    cat << EOF
  942.  
  943. Good! We're all set on the local end, but now we need to know
  944. where to find the software packages to install. First, we need
  945. the IP address of the machine where the Slackware sources are
  946. stored.
  947.  
  948. EOF
  949.    if [ "$UPNRUN" = "y" ]; then
  950.     cat << EOF
  951. Since you're already running on the network, you should be able to use the
  952. hostname instead of an IP address if you wish.
  953.  
  954. EOF
  955.    fi
  956.    echo -n "What is the IP address of your NFS server? "
  957.    read REMOTE_IPADDR;
  958.    if [ ! "$UPNRUN" = "y" ]; then
  959.     cat << EOF
  960.  
  961. Slackware can configure either an INTERNAL ethernet card, or an
  962. EXTERNAL D-Link adaptor.
  963.  
  964. EOF
  965.     echo -n "Which type of ethernet device do you have ([i]nternal, [e]xternal)? "
  966.     read ENET_DEVICE;
  967.     if [ "$ENET_DEVICE" = "e" -o "$ENET_DEVICE" = "E" ]; then
  968.      ENET_DEVICE="dl0"
  969.     else
  970.      ENET_DEVICE="eth0" 
  971.     fi
  972.    fi # ! UPNRUN
  973.    cat << EOF
  974.  
  975. There must be a directory on the server with the Slackware sources for 
  976. each disk in subdirectories beneath it.
  977.  
  978. The installation script needs to know the name of the directory
  979. on your server that contains the disk subdirectories. For example,
  980. if your A3 disk is found at /slackware/a3, then you would
  981. respond: /slackware
  982.  
  983. EOF
  984.    echo -n "What is the Slackware source directory? "
  985.    read REMOTE_PATH;
  986.    echo 
  987.    if [ ! "$UPNRUN" = "y" ]; then
  988.     echo "Configuring ethernet card..."
  989.     ifconfig $ENET_DEVICE $LOCAL_IPADDR netmask $LOCAL_NETMASK broadcast $LOCAL_BROADCAST
  990.     route add -net $LOCAL_NETWORK netmask $LOCAL_NETMASK
  991.     if [ "$HAVE_GATEWAY" = "y" ]; then
  992.      echo "Configuring your gateway..."
  993.      route add default gw $LOCAL_GATEWAY metric 1
  994.     fi
  995.    fi
  996.    echo "Mounting NFS..."
  997.    mount -t nfs $REMOTE_IPADDR:$REMOTE_PATH /var/adm/mount
  998.    SOURCE_MOUNTED="-source_mounted"
  999.    DISTRIBUTION_SOURCE="/var/adm/mount"
  1000.    echo
  1001.   elif [ "$SOURCE_MEDIA" = "5" ]; then
  1002.    cat << EOF
  1003. INSTALLING FROM CD-ROM
  1004.  
  1005. In order to install Slackware Linux from a CD-ROM, it must contain the
  1006. distribution arranged beneath a source directory in the same way as if you
  1007. were to install it from a hard drive or NFS. The source directory must
  1008. contain subdirectories for each floppy disk. Your CD-ROM should be compatible
  1009. with this format if it contains a mirror of the Slackware FTP site. 
  1010.  
  1011. What type of CD-ROM drive do you have?
  1012.  
  1013. 1 -- SCSI [ /dev/scd0 or /dev/scd1 ]
  1014. 2 -- Sony CDU31A [ /dev/cdu31a ]
  1015. 3 -- Sony 535 [ /dev/sonycd ]
  1016. 4 -- Mitsumi  [ /dev/mcd ]
  1017. 5 -- Sound Blaster Pro (Panasonic) [ /dev/spbcd ]
  1018.  
  1019. EOF
  1020.    while [ 0 ]; do
  1021.     echo -n "CD-ROM type (1/2/3/4/5)? "
  1022.     read CD_ROM_TYPE;
  1023.     echo
  1024.     if [ "$CD_ROM_TYPE" = "1" ]; then
  1025.      cat << EOF
  1026. Which SCSI CD-ROM are you using? If you're not sure, select scd0.
  1027.  
  1028. 1 -- /dev/scd0
  1029. 2 -- /dev/scd1
  1030.  
  1031. EOF
  1032.      echo -n "Which SCSI CD-ROM (1/2)? "
  1033.      read WHICH_SCSI_CD;
  1034.      echo
  1035.      if [ "$WHICH_SCSI_CD" = "1" ]; then
  1036.       CD_DEVICE="/dev/scd0"
  1037.       break;
  1038.      else
  1039.       CD_DEVICE="/dev/scd1"
  1040.       break;
  1041.      fi
  1042.     elif [ "$CD_ROM_TYPE" = "2" ]; then
  1043.      CD_DEVICE="/dev/cdu31a"
  1044.      break;
  1045.     elif [ "$CD_ROM_TYPE" = "3" ]; then
  1046.      CD_DEVICE="/dev/sonycd"
  1047.      break;
  1048.     elif [ "$CD_ROM_TYPE" = "4" ]; then
  1049.      CD_DEVICE="/dev/mcd"
  1050.      break;
  1051.     elif [ "$CD_ROM_TYPE" = "5" ]; then
  1052.      CD_DEVICE="/dev/sbpcd"
  1053.      break;
  1054.     fi
  1055.    done
  1056.    # Write out the /etc/fstab line:
  1057.    echo "$CD_DEVICE    /cdrom    iso9660    ro" > /tmp/SeTcdfstab
  1058.    cat << EOF
  1059. Now we need to know which directory on the CD contains the Slackware sources.
  1060. This location may vary depending on the CD you have.
  1061.  
  1062. Here are some directories that we know about:
  1063.  
  1064. Slackware Professional: slakware   (used if you actually want packages installed
  1065.                                     to your hard drive)
  1066. Slackware Professional: slackpro   (used if you want the packages to run mostly
  1067.                                     from the CD-ROM)
  1068. Linux Quarterly CD-ROM: packages/slackware
  1069. TransAmeritech CD-ROM:  slackware.111
  1070. InfoMagic CD-ROM:       distributions/slackware
  1071. CD-ROM A MONTH:         SLACK
  1072.  
  1073. EOF
  1074.    echo -n "What directory are the Slackware sources in? "
  1075.    read SLACK_SOURCE_LOCATION;
  1076.    echo
  1077.    if [ -r /tmp/CDdebug ]; then # we here @ Slackware labs are debuggin' a CD.
  1078.     echo "Source location: $SLACK_SOURCE_LOCATION"
  1079.     echo "Mount command would be:"
  1080.     echo "mount -o ro -t iso9660 $CD_DEVICE /var/adm/mount"
  1081.     echo "This line put in /tmp/SeTcdfstab:"
  1082.     echo "$CD_DEVICE    /cdrom    iso9660    ro"
  1083.     echo
  1084.     echo "Fix it up, Tex, and then type 'exit' to snap back to reality."
  1085.     echo
  1086.     /bin/sh
  1087.    else
  1088.     while [ 0 ]; do
  1089.      mount -o ro -t iso9660 $CD_DEVICE /var/adm/mount
  1090.      if [ ! $? = 0 ]; then
  1091.       cat << EOF
  1092.  
  1093. There was an error attempting to mount the CD-ROM device. Would you like to:
  1094.  
  1095. 1 -- Abort the installation
  1096. 2 -- Attempt to mount the CD-ROM device again
  1097. 3 -- Ignore the error and continue.
  1098.  
  1099. EOF
  1100.       echo -n "Which (1/2/3)? "     
  1101.       read DOWHAT;
  1102.       echo
  1103.       if [ $DOWHAT = 1 ]; then
  1104.        exit;
  1105.       elif [ $DOWHAT = 3 ]; then
  1106.        break;
  1107.       fi
  1108.      else
  1109.       break;
  1110.      fi
  1111.     done
  1112.    fi # debug ?
  1113.    # since we've mounted successfully, let's refresh the link:
  1114.    if [ ! -d $T_PX/dev ]; then
  1115.     mkdir $T_PX/dev
  1116.     chown root.root $T_PX/dev
  1117.     chmod 755 $T_PX/dev
  1118.    fi
  1119.    ( cd $T_PX/dev ; ln -sf $CD_DEVICE cdrom )
  1120.    DISTRIBUTION_SOURCE=/var/adm/mount/$SLACK_SOURCE_LOCATION
  1121.    SOURCE_MOUNTED="-source_mounted"
  1122.   fi # remote sources are now mounted, if they needed to be
  1123.   cat << EOF
  1124.  
  1125. SERIES SELECTION:
  1126. These disk sets (and possibly more) are available:
  1127. EOF
  1128.   print_list;
  1129.   cat << EOF
  1130. You may specify any combination of disk sets at the prompt which follows. For 
  1131. example - to install the base system, the base X window system, and the Tcl 
  1132. toolkit, you would enter: a x tcl  
  1133. EOF
  1134.   echo -n "Which disk sets do you want to install? "
  1135.   read INSTSETS;
  1136.   INSTT="`echo "$INSTSETS" | sed 's/ /#/g'`"
  1137.   INSTT="`echo "$INSTT" | sed 's/,/#/g'`"
  1138.   INSTT="`echo "$INSTT" | sed 's/;/#/g'`"
  1139.   SERIES="-sets #`echo $INSTT`#"
  1140.   cat << EOF
  1141.  
  1142. SOFTWARE INSTALLATION
  1143.  
  1144. Next, software packages are going to be transfered on to your hard drive.
  1145. If this is your first time installing Linux, you should probably use
  1146. PROMPT mode. This will follow a defaults file on the first disk of each
  1147. series you install that will ensure that required packages are installed
  1148. automatically. You will be prompted for the installation of other packages.
  1149.  
  1150. These defaults are user definable -- you may set any package to be added
  1151. or skipped automatically by editing your choices into a file called TAGFILE
  1152. that will be found on the first disk of each series. There will also be a
  1153. copy of the original tagfile called TAGFILE.ORG available in case you want
  1154. to restore the default settings. The tagfile contains all the instructions
  1155. needed to completely automate your installation.
  1156.  
  1157. NOTE: Software may be added to your system after the initial installation.
  1158. A copy of setup will be placed in your /sbin directory. Just type 'setup' to
  1159. add software to your system. Another script, PKGTOOL, may be used to add
  1160. software packages from the current directory, or to cleanly remove packages
  1161. that you want uninstalled.
  1162.  
  1163. If you don't use PROMPT mode, the install program will just go ahead and
  1164. install everything from the disk sets you have selected.
  1165.  
  1166. EOF
  1167.   echo -n "Do you want to use PROMPT mode (y/n)? "
  1168.   read REPLY;
  1169.   echo 
  1170.   if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then
  1171.    IGNORE_TAGFILES=""
  1172.    cat << EOF
  1173. PROMPT mode selected.
  1174.  
  1175. Using prompting defaults found in tagfiles along the way.
  1176.  
  1177. EOF
  1178.    echo "Would you like to use a special tagfile extension?"
  1179.    echo
  1180.    echo "You can specify an extension consisting of a '.' followed by any "
  1181.    echo "combination of 3 characters other than 'tgz'. For instance, I specify"
  1182.    echo "'.pat', and then whenever any tagfiles called 'tagfile.pat' are found"
  1183.    echo "during the installation they are used instead of the default 'tagfile'"
  1184.    echo "files. If the install program does not find tagfiles with the custom"
  1185.    echo "extension, it will use the default tagfiles."
  1186.    echo
  1187.    echo "Enter your custom tagfile extension (including the leading '.'), or just"
  1188.    echo -n "press ENTER to continue without a custom extension. ==>"
  1189.    read CUSTOM_EXT;
  1190.    echo "$CUSTOM_EXT" > /tmp/custom
  1191.   else
  1192.    IGNORE_TAGFILES="-ignore_tagfiles"
  1193.    cat << EOF
  1194. PROMPT mode not selected.
  1195.  
  1196. Installing all the packages on the selected disk sets.
  1197. EOF
  1198.   fi
  1199.   if [ "$DISTRIBUTION_SOURCE" != "" ]; then
  1200.    pkgtool.tty $SOURCE_MOUNTED $IGNORE_TAGFILES -source_device $SOURCE_DEVICE -source_dir $DISTRIBUTION_SOURCE -target_dir $T_PX $SERIES
  1201.   else
  1202.    pkgtool.tty $SOURCE_MOUNTED $IGNORE_TAGFILES -source_device $SOURCE_DEVICE -target_dir $T_PX $SERIES
  1203.   fi
  1204.   if [ ! "$ADDSOFT" = "a" ]; then 
  1205.    if [ -r /tmp/SeTcdfstab ]; then
  1206.     cat /tmp/SeTcdfstab >> $T_PX/fstab
  1207.     mkdir -p $T_PX/cdrom
  1208.    fi
  1209.    echo "none        /proc        proc        defaults" >> $T_PX/fstab
  1210.    echo " " >> $T_PX/fstab
  1211.   fi
  1212.  fi # adding software from / ?
  1213.  # Make 'ROOTDEV' file so /etc/rc.d/rc.S knows which partition to remount
  1214.  # Note - this isn't used anymore, but I guess it doesn't hurt to keep it.
  1215.  if [ ! -r $T_PX/etc/rc.d/ROOTDEV ]; then
  1216.   echo "$ROOT_DEVICE" > $T_PX/etc/rc.d/ROOTDEV
  1217.   chmod 644 $T_PX/etc/rc.d/ROOTDEV
  1218.  fi
  1219.  if [ "$T_PX" = "/" -o "$ADDSOFT" = "a" ]; then
  1220.   cat << EOF
  1221.  
  1222. EXTRA CONFIGURATION
  1223.  
  1224. If you wish, you may now go through the options to reconfigure your
  1225. hardware, make a bootdisk, and install LILO.
  1226.  
  1227. If you've installed a new kernel image, you should go through these
  1228. steps again. Otherwise, it's up to you.
  1229.  
  1230. EOF
  1231.   echo -n "Reconfigure ([y]es, [n]o)? "
  1232.   read RECON;
  1233.   echo
  1234.   if [ "$RECON" = "y" ]; then
  1235.    ADDSOFT="n"
  1236.   else
  1237.    ADDSOFT="a"
  1238.   fi
  1239.  fi
  1240.  if [ ! "$ADDSOFT" = "a" ]; then
  1241.   if [ ! -r $T_PX/etc/fstab ]; then
  1242.    mv $T_PX/fstab $T_PX/etc/fstab
  1243.    chmod 644 $T_PX/etc/fstab
  1244.   fi
  1245.   echo
  1246.   echo "It is recommended that you make a boot disk."
  1247.   echo -n "Would you like to do this ([y]es, [n]o)? "
  1248.   read MAKE_BOOT;
  1249.   if [ "$MAKE_BOOT" = "y" ]; then # we can make a boot disk since the boot drive is free
  1250.    cat << EOF
  1251.  
  1252. BOOT DISK CREATION
  1253.  
  1254. Now put a formatted floppy in your boot drive.
  1255. This will be made into your Linux boot disk. Use this to
  1256. boot Linux until LILO has been configured to boot from
  1257. the hard drive.
  1258.  
  1259. Any data on the target disk will be destroyed.
  1260. EOF
  1261.    echo -n "Insert the disk and press [return], or [s] if you want to skip this step: "
  1262.    read REPLY;
  1263.    echo
  1264.    if [ ! "$REPLY" = "s" ]; then
  1265.     echo "Creating boot disk..."
  1266.     if [ -r $T_PX/vmlinuz ]; then
  1267.      KERNEL='/vmlinuz'
  1268.     else
  1269.      KERNEL='/zImage'
  1270.     fi
  1271.     echo "  - writing kernel to disk: (dd if=$T_PX$KERNEL of=/dev/fd0)"
  1272.     dd if=$T_PX$KERNEL of=/dev/fd0
  1273.     echo "Configuring boot disk..."
  1274.     echo -n "  - boot device: "
  1275.     rdev /dev/fd0 $ROOT_DEVICE
  1276.     echo "(rdev /dev/fd0 $ROOT_DEVICE)"
  1277.     echo -n "  - video mode: "
  1278.     rdev -v /dev/fd0 -1
  1279.     echo "(rdev -v /dev/fd0 -1)"
  1280.     echo -n "  - mount root read-only: "
  1281.     echo "(rdev -R /dev/fd0 1)"
  1282.     rdev -R /dev/fd0 1
  1283.     sync
  1284.     echo "Boot disk created."
  1285.    else
  1286.     echo "Boot disk creation skipped."
  1287.     echo "You better install LILO, or you'll have a hard time booting."
  1288.    fi
  1289.    echo 
  1290.   fi
  1291.   echo
  1292.   echo "MODEM/MOUSE CONFIGURATION"
  1293.   while [ 0 ]; do
  1294.    cat << EOF
  1295.  
  1296. Modem Setup:
  1297.  
  1298. A link in /dev will be created from your callout device (cua0, cua1,
  1299. cua2, cua3) to /dev/modem. You can change this link later if you put
  1300. your modem on a different port.
  1301.  
  1302. EOF
  1303.    echo -n "Would you like to set up your modem ([y]es, [n]o)? "
  1304.    read REPLY;
  1305.    if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then
  1306.     cat << EOF
  1307.  
  1308. These are the standard serial I/O devices:
  1309.  
  1310. 0 -- /dev/ttyS0 (or com1: under DOS)
  1311. 1 -- /dev/ttyS1 (or com2: under DOS)
  1312. 2 -- /dev/ttyS2 (or com3: under DOS)
  1313. 3 -- /dev/ttyS3 (or com4: under DOS)
  1314.  
  1315. EOF
  1316.     echo -n "Which device is your modem attached to (0, 1, 2, 3)? "
  1317.     read MODEM_DEVICE;
  1318.     if [ "$MODEM_DEVICE" = "0" ]; then
  1319.      (cd $T_PX/dev; ln -sf cua0 modem)
  1320.      break;
  1321.     elif [ "$MODEM_DEVICE" = "1" ]; then
  1322.      (cd $T_PX/dev; ln -sf cua1 modem)
  1323.      break;
  1324.     elif [ "$MODEM_DEVICE" = "2" ]; then
  1325.      (cd $T_PX/dev; ln -sf cua2 modem)
  1326.      break;
  1327.     elif [ "$MODEM_DEVICE" = "3" ]; then
  1328.      (cd $T_PX/dev; ln -sf cua3 modem)
  1329.      break;
  1330.     else
  1331.      echo "Not a valid device. Please hit [enter] to try again, or [q]"
  1332.      echo -n "to skip modem configuration."
  1333.      read REPLY;
  1334.      if [ "$REPLY" = "q" ]; then
  1335.       break;
  1336.      fi
  1337.      echo
  1338.     fi
  1339.    else
  1340.     break;
  1341.    fi
  1342.   done
  1343.   while [ 0 ]; do
  1344.    cat << EOF
  1345.  
  1346. Mouse Setup:
  1347.  
  1348. A link will be created in /dev from your mouse device to /dev/mouse.
  1349. You can change this link later if you switch to a different type of
  1350. mouse.
  1351.  
  1352. EOF
  1353.    MTYPE="none"
  1354.    echo -n "Would you like to set up your mouse ([y]es, [n]o)? "
  1355.    read REPLY;
  1356.    if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]; then
  1357.     cat << EOF
  1358.  
  1359. These types are supported:
  1360.  
  1361. 1 -- Microsoft compatible serial mouse.
  1362. 2 -- QuickPort or PS/2 style mouse. (Auxiliary port).
  1363. 3 -- Logitech Bus Mouse
  1364. 4 -- ATI XL Bus Mouse
  1365. 5 -- Microsoft Bus Mouse
  1366. 6 -- Mouse Systems serial mouse
  1367.  
  1368. EOF
  1369.     echo -n "Which type of mouse do you have (1, 2, 3, 4, 5, 6) ? "
  1370.     read MOUSE_TYPE;
  1371.     if [ "$MOUSE_TYPE" = "1" -o "$MOUSE_TYPE" = "6" ]; then
  1372.      cat << EOF
  1373.  
  1374. These are the standard serial I/O devices:
  1375.  
  1376. 0 -- /dev/ttyS0 (or com1: under DOS)
  1377. 1 -- /dev/ttyS1 (or com2: under DOS)
  1378. 2 -- /dev/ttyS2 (or com3: under DOS)
  1379. 3 -- /dev/ttyS3 (or com4: under DOS)
  1380.  
  1381. EOF
  1382.      echo -n "Which device is your mouse attached to (0, 1, 2, 3)? "
  1383.      read MOUSE_DEVICE;
  1384.      if [ "$MOUSE_TYPE" = "1" ]; then
  1385.       MTYPE="ms"
  1386.      else
  1387.       MTYPE="msc"
  1388.      fi
  1389.      if [ "$MOUSE_DEVICE" = "0" ]; then
  1390.       (cd $T_PX/dev; ln -sf cua0 mouse)
  1391.       break;
  1392.      elif [ "$MOUSE_DEVICE" = "1" ]; then
  1393.       (cd $T_PX/dev; ln -sf cua1 mouse)
  1394.       break;
  1395.      elif [ "$MOUSE_DEVICE" = "2" ]; then
  1396.       (cd $T_PX/dev; ln -sf cua2 mouse)
  1397.       break;
  1398.      elif [ "$MOUSE_DEVICE" = "3" ]; then
  1399.       (cd $T_PX/dev; ln -sf cua3 mouse)
  1400.       break;
  1401.      fi
  1402.     elif [ "$MOUSE_TYPE" = "2" ]; then
  1403.      (cd $T_PX/dev; ln -sf ps2aux mouse)
  1404.      MTYPE="ps2"
  1405.      break;
  1406.     elif [ "$MOUSE_TYPE" = "3" ]; then
  1407.      (cd $T_PX/dev; ln -sf bmouselogitec mouse)
  1408.      MTYPE="logi"
  1409.      break;
  1410.     elif [ "$MOUSE_TYPE" = "4" ]; then
  1411.      (cd $T_PX/dev; ln -sf bmouseatixl mouse)
  1412.      MTYPE="bm"
  1413.      break;
  1414.     elif [ "$MOUSE_TYPE" = "5" ]; then
  1415.      (cd $T_PX/dev; ln -sf bmousems mouse)
  1416.      MTYPE="bm"
  1417.      break;
  1418.     else
  1419.      echo "Incorrect mouse selection. Please try again."
  1420.     fi
  1421.     echo
  1422.    else
  1423.     break;
  1424.    fi
  1425.   done
  1426.   export MTYPE
  1427.   ( cd $T_PX ; chmod 755 ./ )
  1428.   ( cd $T_PX ; chmod 755 ./var )
  1429.   if [ ! -d $T_PX/proc ]; then
  1430.    mkdir $T_PX/proc
  1431.    chown root.root $T_PX/proc
  1432.   fi
  1433.   if [ ! -r $T_PX/sbin/setup ]; then
  1434.    cp /bin/setup.tty $T_PX/sbin
  1435.    cp /bin/pkgtool.tty $T_PX/sbin
  1436.    ( cd $T_PX/sbin ; ln -sf setup.tty setup ; ln -sf pkgtool.tty pkgtool )
  1437.   fi
  1438.   if [ ! -d $T_PX/var/spool/uucp ]; then
  1439.    mkdir -p $T_PX/var/spool/uucp
  1440.   fi
  1441.   if [ ! -d $T_PX/var/spool/mail ]; then
  1442.    mkdir -p $T_PX/var/spool/mail
  1443.    chmod 755 $T_PX/var/spool
  1444.    chown root.mail $T_PX/var/spool/mail
  1445.    chmod 775 $T_PX/var/spool/mail
  1446.   fi 
  1447.  
  1448.   # Post installation and setup scripts added by packages.
  1449.   if [ -d $T_PX/var/adm/setup ]; then
  1450.    if [ "$T_PX" = "/" ]; then
  1451.     ROOT_DEVICE="`mount | fgrep "on / " | cut -b-10`"
  1452.    fi
  1453.    for INSTALL_SCRIPTS in $T_PX/var/adm/setup/setup.*
  1454.    do
  1455.     SCRIPT=`basename $INSTALL_SCRIPTS`
  1456.     # Here, we call each script in /var/adm/setup. Two arguments are provided:
  1457.     # 1 -- the target prefix (normally /, but /mnt from the bootdisk)
  1458.     # 2 -- the name of the root device.
  1459.     ( cd $T_PX ; sh var/adm/setup/$SCRIPT $T_PX $ROOT_DEVICE )
  1460.     if echo $SCRIPT | fgrep onlyonce 1> /dev/null 2> /dev/null; then # only run after first install
  1461.      if [ ! -d $T_PX/var/adm/setup/install ]; then
  1462.       mkdir $T_PX/var/adm/setup/install
  1463.      fi
  1464.      mv $INSTALL_SCRIPTS $T_PX/var/adm/setup/install
  1465.     fi
  1466.    done
  1467.   fi
  1468.  
  1469.  fi # ! just adding stuff
  1470.  rm -f $T_PX/tagfile
  1471.  if [ "$REMAPPING_DONE" = "true" ]; then
  1472.   if [ -r $T_PX/usr/lib/kbd/keytables/$SHORTNAME ]; then
  1473.    if fgrep $SHORTNAME $T_PX/etc/rc.d/rc.local 1> /dev/null 2> /dev/null ; then
  1474.     echo > /dev/null
  1475.    else
  1476.     echo "echo 'Loading keyboard map \"$SHORTNAME\"...'" >> $T_PX/etc/rc.d/rc.local
  1477.     echo "/usr/bin/loadkeys /usr/lib/kbd/keytables/$SHORTNAME" >> $T_PX/etc/rc.d/rc.local
  1478.    fi
  1479.   else
  1480.    cat << EOF
  1481. You loaded a custom keyboard map ($SHORTNAME), but didn't
  1482. install the keytable package. Rather than tell you you're
  1483. just out of luck, I suppose I'll install a minimal keymap
  1484. system for you. :^)
  1485. EOF
  1486.    mkdir -p $T_PX/usr/lib/kbd/keytables
  1487.    chmod 755 $T_PX/usr/lib/kbd/keytables
  1488.    cp /tmp/keymap/* $T_PX/usr/lib/kbd/keytables
  1489.    cp /bin/loadkeys /mnt/usr/bin
  1490.    echo "echo 'Loading keyboard map \"$SHORTNAME\"...'" >> $T_PX/etc/rc.d/rc.local
  1491.    echo "/usr/bin/loadkeys /usr/lib/kbd/keytables/$SHORTNAME" >> $T_PX/etc/rc.d/rc.local
  1492.   fi
  1493.  fi 
  1494.  sync
  1495.  if [ "$T_PX" = "/" ]; then
  1496.   echo "Installation of additional software is now complete."
  1497.  else
  1498.   echo "Linux installation is complete. "
  1499.  fi
  1500.  if [ "$T_PX" = "/mnt" ]; then
  1501.   echo 
  1502.   echo "You may now reboot your computer by pressing control+alt+delete."
  1503.   echo 
  1504.  fi
  1505.  if [ "$T_PX" = "/mnt" ]; then
  1506.   echo "If you installed LILO, remove the boot disk from your computer "
  1507.   echo "before rebooting. "
  1508.  fi
  1509.  if [ "y" = "$T_MT" ]; then
  1510.   if [ ! "$ADDSOFT" = "a" ]; then
  1511.    echo
  1512.    echo "Don't forget to create your /etc/fstab if you don't have one!"
  1513.    echo "(vi $T_PX/etc/fstab)"
  1514.    echo
  1515.   fi
  1516.  fi
  1517.  echo 
  1518. else
  1519.  cat << EOF
  1520. You have not yet designated any disk partitions as Linux native.
  1521.  
  1522. If you are planning to use OS/2 Boot Manager, make your Linux
  1523. partitions with OS/2 fdisk, reboot this disk, and then use Linux
  1524. fdisk to tag the partitions as type 83 (Linux native).
  1525.  
  1526. Linux fdisk will select a default device when called without
  1527. arguments, and from there it is menu driven. If you don't want
  1528. to partition the default device, then call fdisk with the device
  1529. you want as the argument, like this:
  1530.  
  1531. fdisk /dev/hdb
  1532.  
  1533. If you are not using the OS/2 Boot Manager, then you may use Linux
  1534. fdisk to create partitions for Linux. Other than the exception for
  1535. the OS/2 Boot Manager, you are usually better off creating partitions
  1536. for a given OS using a partitioning tool native to that OS. In other
  1537. words, you probably shouldn't try to make your DOS or other non-Linux
  1538. partitions with the Linux fdisk.
  1539.  
  1540. Please make one or more partitions for Linux, and try setup again.
  1541. If you haven't already, you might want to also make a swap partition
  1542. while you're in fdisk. 8 megabytes would be a good starting size for
  1543. a single user system. Linux swap is tagged as type 82.
  1544. EOF
  1545.  exit;
  1546. fi
  1547. if mount | fgrep /var/adm/mount 1> /dev/null 2> /dev/null ; then
  1548.  umount /var/adm/mount 
  1549. fi
  1550. rm -f /var/adm/mount 2> /dev/null
  1551. rmdir /var/adm/mount 2> /dev/null
  1552. mkdir /var/adm/mount 2> /dev/null
  1553. chmod 755 /var/adm/mount
  1554. if [ -r /tagfile ]; then
  1555.  rm -f /tagfile
  1556. fi
  1557. chmod 755 $T_PX
  1558. chmod 1777 $T_PX/tmp
  1559. rm -f /tmp/custom
  1560. # end slackware setup script
  1561.