home *** CD-ROM | disk | FTP | other *** search
/ Enter 2006 October / Enter 10 2006.iso / boot / isolinux / initrd / in / usr / lib / setup / SeTpartitions < prev    next >
Encoding:
Text File  |  2006-07-28  |  18.8 KB  |  516 lines

  1. #!/bin/sh
  2. # SeTpartition user-friendly rewrite Fri Dec 15 13:17:40 CST 1995 pjv
  3. # Rewrite to support filesystem plugins <david@slackware.com>, 07-May-2001
  4. # Don't use plugins, make it work, pjv, 18-May-2001.
  5. # Generalize tempscript creation and support JFS and XFS. pjv, 30-Mar-2002
  6. # Added Reiser4 support <maestromae@kateos.org> 11-JUN-2005
  7. TMP=/var/log/setup/tmp
  8. NDIR=/dev/null
  9. REDIR=/dev/tty4
  10. T_PX=/mnt
  11. export TEXTDOMAIN=SeTpartitions
  12.  
  13. # FUNCTIONS
  14.  
  15. # crunch() -  remove extra whitespace
  16. crunch () {
  17.    read STRING;
  18.    echo $STRING
  19. }
  20.  
  21. # make_ext2( dev, nodes, check ) - Create a new ext2 filesystem on the named
  22. #                                device with the specified inode density.
  23. # Parameters:  dev     Device node to format.
  24. #              nodes   Inode density (1024, 2048, 4096)
  25. #              check   Perform fs check (y or n)
  26. make_ext2() {
  27.    # get the size of the named partition
  28.    SIZE=`get_part_size $1`
  29.    # output a nice status message
  30.    INODE_DENSITY="`gettext "Inode density: 1 inode per"` $2 `gettext "bytes"`."
  31.    dialog --title "`gettext "FORMATTING"`" \
  32.    --backtitle "`gettext "Formatting"` $1 `gettext "with filesystem"` ext2." \
  33.    --infobox "`gettext "Formatting"` $1  \n\
  34. `gettext "Size in 1K blocks:"` $SIZE \n\
  35. `gettext "Filesystem type:"` ext2 \n\
  36. $INODE_DENSITY " 0 0
  37.    # do the format
  38.    if mount | fgrep "$1 " 1> $NDIR 2> $NDIR ; then
  39.       umount $1 2> $NDIR
  40.    fi
  41.    if [ "$3" = "y" ]; then
  42.       mke2fs -c -i $2 $1 1> $REDIR 2> $REDIR
  43.    else
  44.       mke2fs -i $2 $1 1> $REDIR 2> $REDIR
  45.    fi
  46. }
  47.  
  48. # make_ext3( dev, nodes, check ) - Create a new ext3 filesystem on the named
  49. #                                device with the specified inode density.
  50. # Parameters:  dev     Device node to format.
  51. #              nodes   Inode density (1024, 2048, 4096)
  52. #              check   Perform fs check (y or n)
  53. make_ext3() {
  54.    modprobe ext3 &>/dev/null    
  55.    # get the size of the named partition
  56.    SIZE=`get_part_size $1`
  57.    # output a nice status message
  58.    INODE_DENSITY="`gettext "Inode density: 1 inode per"` $2 `gettext "bytes"`."
  59.    dialog --title "`gettext "FORMATTING"`" \
  60.    --backtitle "`gettext "Formatting"` $1 `gettext "with filesystem"` ext3." \
  61.    --infobox "`gettext "Formatting"` $1  \n\
  62. `gettext "Size in 1K blocks:"` $SIZE \n\
  63. `gettext "Filesystem type:"` ext3 \n\
  64. $INODE_DENSITY " 0 0
  65.    # do the format
  66.    if mount | fgrep "$1 " 1> $NDIR 2> $NDIR ; then
  67.       umount $1 2> $NDIR
  68.    fi
  69.    if [ "$3" = "y" ]; then
  70.       mke2fs -j -c -i $2 $1 1> $REDIR 2> $REDIR
  71.    else
  72.       mke2fs -j -i $2 $1 1> $REDIR 2> $REDIR
  73.    fi
  74. }
  75.  
  76. # make_jfs( dev, check ) - Create a new jfs filesystem on the named
  77. #                                device with the specified inode density.
  78. # Parameters:  dev     Device node to format.
  79. #              check   Perform fs check (y or n)
  80. make_jfs() {
  81.    modprobe jfs &>/dev/null
  82.    # get the size of the named partition
  83.    SIZE=`get_part_size $1`
  84.    # output a nice status message
  85.    dialog --title "`gettext "FORMATTING"`" \
  86.    --backtitle "`gettext "Formatting"` $1 `gettext "with filesystem"` jfs." \
  87.    --infobox "`gettext "Formatting"` $1  \n\
  88. `gettext "Size in 1K blocks:"` $SIZE \n\
  89. `gettext "Filesystem type:"` jfs" 0 0
  90.    # do the format
  91.    if mount | fgrep "$1 " 1> $NDIR 2> $NDIR ; then
  92.       umount $1 2> $NDIR
  93.    fi
  94.    if [ "$2" = "y" ]; then
  95.       mkfs.jfs -c -q $1 1> $REDIR 2> $REDIR
  96.    else
  97.       mkfs.jfs -q $1 1> $REDIR 2> $REDIR
  98.    fi
  99. }
  100.  
  101. # make_reiserfs( dev ) - Create a new reiserfs filesystem on the named dev
  102. # Parameters:  dev     Device node to format.
  103. make_reiserfs() {
  104.    modprobe reiserfs &>/dev/null
  105.    # get the size of the named partition
  106.    SIZE=`get_part_size $1`
  107.    # output a nice status message
  108.    dialog --title "`gettext "FORMATTING"`" \
  109.    --backtitle "`gettext "Formatting"` $1 `gettext "with filesystem"` reiserfs." \
  110.    --infobox "`gettext "Formatting"` $1  \n\
  111. `gettext "Size in 1K blocks:"` $SIZE \n\
  112. `gettext "Filesystem type:"` reiserfs " 0 0
  113.    # do the format
  114.    if mount | fgrep "$1 " 1> $NDIR 2> $NDIR ; then
  115.       umount $1 2> $NDIR
  116.    fi
  117.    echo "y" | mkreiserfs $1 1> $REDIR 2> $REDIR
  118. }
  119.  
  120. # Make Reiser4 filesystem.
  121. make_reiser4fs() {
  122.    modprobe reiser4 &>/dev/null
  123.    # get the size of the named partition
  124.    SIZE=`get_part_size $1`
  125.    # output a nice status message
  126.    dialog --title "`gettext "FORMATTING"`" \
  127.    --backtitle "`gettext "Formatting"` $1 `gettext "with filesystem"` reiser4." \
  128.    --infobox "`gettext "Formatting"` $1  \n\
  129. `gettext "Size in 1K blocks:"` $SIZE \n\
  130. `gettext "Filesystem type:"` reiser4 " 0 0
  131.    # do the format
  132.    if mount | fgrep "$1 " 1> $NDIR 2> $NDIR ; then
  133.       umount $1 2> $NDIR
  134.    fi
  135.    echo "y" | make_reiser4 $1 1> $REDIR 2> $REDIR
  136. }
  137.  
  138.  
  139. # make_xfs( dev ) - Create a new xfs filesystem on the named dev
  140. # Parameters:  dev     Device node to format.
  141. make_xfs() {
  142.    modprobe xfs &>/dev/null    
  143.    # get the size of the named partition
  144.    SIZE=`get_part_size $1`
  145.    # output a nice status message
  146.    dialog --title "`gettext "FORMATTING"`" \
  147.    --backtitle "`gettext "Formatting"` $1 `gettext "with filesystem"` xfs." \
  148.    --infobox "`gettext "Formatting"` $1  \n\
  149. `gettext "Size in 1K blocks:"` $SIZE \n\
  150. `gettext "Filesystem type:"` xfs " 0 0
  151.    # do the format
  152.    if mount | fgrep "$1 " 1> $NDIR 2> $NDIR ; then
  153.       umount $1 2> $NDIR
  154.    fi
  155.    mkfs.xfs -f $1 1> $REDIR 2> $REDIR
  156. }
  157.  
  158. # gen_part_list() - Prints out a partition listing for the system into the
  159. gen_part_list() {
  160.    export COUNT=0
  161.    cat $TMP/SeTplist | while [ 0 ]; do
  162.       read PARTITION;
  163.       if [ "$PARTITION" = "" ]; then
  164.          break;
  165.       fi
  166.       # Variables, variables, variables
  167.       NAME=`echo $PARTITION | crunch | cut -f 1 -d ' '`
  168.       SIZE=`echo "$PARTITION" | tr -d "*" | tr -d "+" | crunch | cut -f 4 -d ' '`
  169.       ALTNAME=""
  170.       DEVICE=`echo "$PARTITION" | tr -d "*" | crunch | cut -f 1 -d ' '`
  171.       # See if this partition is in use already
  172.       if fgrep "$DEVICE " $TMP/SeTnative 1> $NDIR; then # it's been used
  173.          ON=`fgrep "$DEVICE " $TMP/SeTnative | crunch | cut -f 2 -d ' '`
  174.          ALTNAME="$DEVICE on $ON Linux ${SIZE}K"
  175.       fi
  176.       # Add a menu item
  177.       if [ "$ALTNAME" = "" ]; then
  178.          echo "\"$NAME\" \"Linux ${SIZE}K\" \\" >> $TMP/tempscript
  179.          echo "`gettext "false"`" > $TMP/SeTSKIP # this flag is used for non-root parts
  180.       else
  181.          echo "\"`gettext "(IN USE)"`\" \"$ALTNAME\" \\" >> $TMP/tempscript
  182.       fi
  183.    done
  184.    echo "\"---\" \"`gettext "(done adding partitions, continue with setup)"`\" \\" >> $TMP/tempscript
  185.    echo "\"---\" \"`gettext "(done adding partitions, continue with setup)"`\" \\" >> $TMP/tempscript
  186.    echo "\"---\" \"`gettext "(done adding partitions, continue with setup)"`\" \\" >> $TMP/tempscript
  187.    echo "\"---\" \"`gettext "(done adding partitions, continue with setup)"`\" \\" >> $TMP/tempscript
  188.    echo "\"---\" \"`gettext "(done adding partitions, continue with setup)"`\" \\" >> $TMP/tempscript
  189.    echo "2> $TMP/return" >> $TMP/tempscript
  190. }
  191.  
  192. # ask_format( dev ) - Asks the user if he/she wants to format the named device
  193. ask_format() {
  194.    dialog --title "`gettext "FORMAT PARTITION"` $1" --menu "`gettext "If this partition has \
  195. not been formatted, you should format it.  NOTE: This will erase all data on \
  196. it.  Would you like \
  197. to format this partition?"`" 12 70 3 \
  198.    "`gettext "Format"`" "`gettext "Quick format with no bad block checking"`" \
  199.    "`gettext "Check"`" "`gettext "Slow format that checks for bad blocks"`" \
  200.    "`gettext "No"`" "`gettext "No, do not format this partition"`" 2> $TMP/return
  201.    if [ ! $? = 0 ]; then
  202.      rm -f $TMP/return
  203.      exit
  204.    fi
  205. }
  206.  
  207. # ask_nodes( dev ) - Asks the user for the inode density for the named device.
  208. ask_nodes() {
  209.    dialog --title "`gettext "SELECT INODE DENSITY FOR"` $1" \
  210. --backtitle "`gettext "Partition"` $1 `gettext "will be formatted."`" \
  211. --menu "`gettext "If you're going to \
  212. have many small files on your drive, then you may need more inodes than the \
  213. default (one is used for each file entry).  You can change the density to one \
  214. inode per 2048 bytes, or even per 1024 bytes.  Select '2048' or '1024', or \
  215. just hit enter to accept the default of 4096 bytes."`" 14 70 3 \
  216.    "4096" "`gettext "1 inode per"` 4096 `gettext "bytes"`. `gettext "(default)"`" \
  217.    "2048" "`gettext "1 inode per"` 2048 `gettext "bytes"`." \
  218.    "1024" "`gettext "1 inode per"` 1024 `gettext "bytes"`." 2> $TMP/return
  219.    if [ ! $? = 0 ]; then
  220.      rm -f $TMP/return
  221.      exit
  222.    fi
  223. }
  224.  
  225. # ask_fs( dev ) - Asks the user the type of filesystem to use for the named
  226. #                 device.  Answer in $TMP/return
  227. ask_fs() {
  228.     EXT2="`gettext "Ext2 is the traditional Linux file system and is fast and stable. "`"
  229.     EXT3="`gettext "Ext3 is the journaling version of the Ext2 filesystem. "`"
  230.     REISERFS="`gettext "ReiserFS is a journaling filesystem that stores all files and filenames in a balanced tree structure. "`"
  231.     REISER4="`gettext "Reiser4 is an atomic filesystem that stores all files and filenames in a dancing tree structure. Reiser 4 is STILL UNSTABLE !!! USE IT AT YOUR OWN RISK !!! "`"
  232.     JFS="`gettext "JFS is IBM's Journaled Filesystem, currently used in IBM enterprise servers. "`"
  233.     XFS="`gettext "XFS is SGI's journaling filesystem that originated on IRIX. "`"
  234.     DEFAULT=reiserfs
  235.  
  236. echo "dialog --title \"`gettext "SELECT FILESYSTEM FOR"` $1\" \
  237. --backtitle \"`gettext "Partition"` $1 `gettext "will be formatted."`\" \
  238.  --default-item $DEFAULT --menu \
  239. \"`gettext "Please select the type of filesystem to use for the specified"`   \n\
  240. `gettext "device.  Here are descriptions of the available filesystems:"`  $EXT2 $EXT3 $JFS $REISERFS $XFS $REISER4\" \
  241. 0 0 0 \\" > $TMP/tempscript
  242.  
  243.   if [ ! "$EXT2" = "" ]; then
  244.     echo "\"ext2\" \"`gettext "Standard Linux ext2fs filesystem"`\" \\" >> $TMP/tempscript
  245.   fi
  246.   if [ ! "$EXT3" = "" ]; then
  247.     echo "\"ext3\" \"`gettext "Journaling version of the ext2fs filesystem"`\" \\" >> $TMP/tempscript
  248.   fi
  249.   if [ ! "$JFS" = "" ]; then
  250.     echo "\"jfs\" \"`gettext "IBM's Journaled Filesystem"`\" \\" >> $TMP/tempscript
  251.   fi
  252.   if [ ! "$REISERFS" = "" ]; then
  253.     echo "\"reiserfs\" \"`gettext "Hans Reiser's Journaling Filesystem"`\" \\" >> $TMP/tempscript
  254.   fi
  255.   if [ ! "$REISER4" = "" ]; then
  256.     echo "\"reiser4\" \"`gettext "EXPERIMENTAL !!! - Hans Reiser's Journaling Filesystem V4"`\" \\" >> $TMP/tempscript
  257.   fi
  258.  
  259.   if [ ! "$XFS" = "" ]; then
  260.     echo "\"xfs\" \"`gettext "SGI's journaling filesystem"`\" \\" >> $TMP/tempscript
  261.   fi
  262.   echo "2> $TMP/return" >> $TMP/tempscript
  263.   . $TMP/tempscript
  264.   if [ ! $? = 0 ]; then
  265.     rm -f $TMP/return
  266.     exit
  267.   fi
  268. }
  269.  
  270. # get_part_size( dev ) - Return the size in KB of the named partition.
  271. get_part_size() {
  272.    Size=`probe -l | fgrep "$1 " | tr -d "*" | tr -d "+" | crunch | cut -f 4 -d ' '`
  273.    echo $Size
  274. }
  275.  
  276. # MAIN
  277.  
  278. if [ ! -d $TMP ]; then
  279.    mkdir -p $TMP
  280. fi
  281.  
  282. if [ ! -r $TMP/SeTplist ]; then
  283.    # Give warning?
  284.    exit
  285. fi
  286.  
  287. cat /dev/null >> $TMP/SeTnative
  288.  
  289. echo "dialog --title \"`gettext "Select Linux installation partition:"`\" --ok-label "`gettext "Select"`" --cancel-label "`gettext "Continue"`" --menu \\
  290. \"`gettext "Please select a partition from the following list to use for your \
  291. root (/) Linux partition."`\" 13 70 5 \\" > $TMP/tempscript
  292.  
  293. gen_part_list
  294.  
  295. . $TMP/tempscript
  296. if [ ! $? = 0 ]; then
  297.    rm $TMP/tempscript
  298.    exit 255 # user abort
  299. fi
  300.  
  301. ROOT_DEVICE="`cat $TMP/return`"
  302. rm $TMP/tempscript
  303. if [ "$ROOT_DEVICE" = "---" ]; then
  304.    exit 255
  305. fi
  306.  
  307. # format root partition?
  308. ask_format $ROOT_DEVICE
  309. DOFORMAT="`cat $TMP/return`"
  310. rm -f $TMP/return
  311. if [ ! "$DOFORMAT" = "`gettext "No"`" ]; then
  312.   ask_fs $ROOT_DEVICE
  313.   ROOT_SYS_TYPE="`cat $TMP/return`"
  314.   cat $TMP/return > $TMP/ROOTFS
  315.   rm -f $TMP/return
  316.   # create the filesystem
  317.   if [ "$ROOT_SYS_TYPE" = "`gettext "ext2"`" ]; then
  318.     ask_nodes $ROOT_DEVICE
  319.     NODES="`cat $TMP/return`"
  320.     rm -f $TMP/return
  321.     if [ ! "$NODES" = "2048" -a ! "$NODES" = "1024" ]; then
  322.       NODES=4096
  323.     fi
  324.     if [ "$DOFORMAT" = "`gettext "Check"`" ]; then
  325.       make_ext2 $ROOT_DEVICE $NODES "y"
  326.     else
  327.       make_ext2 $ROOT_DEVICE $NODES "n"
  328.     fi
  329.   elif [ "$ROOT_SYS_TYPE" = "`gettext "ext3"`" ]; then
  330.     ask_nodes $ROOT_DEVICE
  331.     NODES="`cat $TMP/return`"
  332.     rm -f $TMP/return
  333.     if [ ! "$NODES" = "2048" -a ! "$NODES" = "1024" ]; then
  334.       NODES=4096
  335.     fi
  336.     if [ "$DOFORMAT" = "`gettext "Check"`" ]; then
  337.       make_ext3 $ROOT_DEVICE $NODES "y"
  338.     else
  339.       make_ext3 $ROOT_DEVICE $NODES "n"
  340.     fi
  341.   elif [ "$ROOT_SYS_TYPE" = "reiserfs" ]; then
  342.     make_reiserfs $ROOT_DEVICE
  343.   elif [ "$ROOT_SYS_TYPE" = "reiser4" ]; then
  344.     make_reiser4fs $ROOT_DEVICE
  345.   elif [ "$ROOT_SYS_TYPE" = "jfs" ]; then
  346.     if [ "$DOFORMAT" = "Check" ]; then
  347.       make_jfs $ROOT_DEVICE "y"
  348.     else
  349.       make_jfs $ROOT_DEVICE "n"
  350.     fi
  351.   elif [ "$ROOT_SYS_TYPE" = "xfs" ]; then
  352.     make_xfs $ROOT_DEVICE
  353.   fi
  354. fi # DOFORMAT?
  355.  
  356. # Now, we need to mount the newly selected root device:
  357. sync
  358. # If we didn't format the partition, then we don't know what fs type it is.
  359. # So, we will try the types we know about, and let mount figure it out if all else fails:
  360. for fs in "-t ext3" "-t ext2" "-t reiserfs" "-t reiser4" "" ; do
  361.   if mount $ROOT_DEVICE $T_PX $fs 1> $REDIR 2> $REDIR ; then
  362.     break
  363.   fi
  364.   sleep 1
  365. done
  366. sleep 1
  367. ROOT_SYS_TYPE=`mount | grep "^$ROOT_DEVICE on " | cut -f 5 -d ' '`
  368. #echo "$ROOT_DEVICE       /        $ROOT_SYS_TYPE        defaults   1   1" > $TMP/SeTnative
  369. printf "%-16s %-16s %-11s %-16s %-3s %s\n" "$ROOT_DEVICE" "/" "$ROOT_SYS_TYPE" "defaults" "1" "1" > $TMP/SeTnative
  370. echo $ROOT_DEVICE > $TMP/SeTrootdev
  371. # done mounting the target root partition
  372.  
  373. # More than one Linux partition
  374. if [ ! "`cat $TMP/SeTplist | sed -n '2 p'`" = "" ]; then
  375.    while [ 0 ]; do # next partition loop
  376.       # OK, we will set this flag, and if we find an unused partition, we
  377.       # change it.  If it doesn't get switched, we skip the next menu.
  378.       rm -f $TMP/SeTSKIP
  379.       echo "true" > $TMP/SeTSKIP
  380.  
  381. echo "dialog --title \"`gettext "Select other Linux partitions for /etc/fstab"`\" \
  382. --ok-label `gettext "Select"` --cancel-label `gettext "Continue"` \
  383. --menu \"`gettext "You seem to have more than one partition tagged as type Linux.  \
  384. You may use these to distribute your Linux system across more than \
  385. one partition.  Currently, you have"` $ROOT_DEVICE `gettext "mounted as your / partition.  \
  386. You might want to mount directories such as /home or /usr/local \
  387. on separate partitions.  You should not try to mount /etc, /sbin, or /bin on \
  388. their own partitions since they contain utilities needed to bring the system \
  389. up and mount partitions.  Also, do not reuse a partition that you've already \
  390. entered before.  Please select one of the Linux partitions listed below, or \
  391. if you're done, hit"` <`gettext "Continue"`>.\" 20 70 4 \\" > $TMP/tempscript
  392.  
  393.       gen_part_list
  394.  
  395.       if [ "`cat $TMP/SeTSKIP`" = "true" ]; then
  396.          break;
  397.       fi
  398.       rm -rf $TMP/return
  399.  
  400.       . $TMP/tempscript
  401.       if [ ! $? = 0 ]; then
  402.          break;
  403.       fi
  404.  
  405.       NEXT_PARTITION=`cat $TMP/return`
  406.       if [ "$NEXT_PARTITION" = "---" ]; then
  407.          break;
  408.       elif [ "$NEXT_PARTITION" = "`gettext "(IN USE)"`" ]; then
  409.          continue;
  410.       fi
  411.  
  412.       # We now have the next partition, ask the user what to do with it:
  413.       ask_format $NEXT_PARTITION
  414.  
  415.       DOFORMAT="`cat $TMP/return`"
  416.       rm -f $TMP/return
  417.  
  418.       BACKT="`gettext "Partition"` $NEXT_PARTITION `gettext "will not be reformatted."`"
  419.       if [ ! "$DOFORMAT" = "`gettext "No"`" ]; then
  420.         ask_fs $NEXT_PARTITION
  421.         NEXT_SYS_TYPE="`cat $TMP/return`"
  422.         rm -f $TMP/return
  423.         BACKT="`gettext "Partition"` $NEXT_PARTITION `gettext "will be formatted with"` $NEXT_SYS_TYPE."
  424.         # create the filesystem
  425.         if [ "$NEXT_SYS_TYPE" = "ext2" ]; then
  426.           ask_nodes $NEXT_PARTITION
  427.           NODES="`cat $TMP/return`"
  428.           rm -f $TMP/return
  429.           if [ ! "$NODES" = "2048" -a ! "$NODES" = "1024" ]; then
  430.             NODES=4096
  431.           fi
  432.           if [ "$DOFORMAT" = "`gettext "Check"`" ]; then
  433.             make_ext2 $NEXT_PARTITION $NODES "y"
  434.           else
  435.             make_ext2 $NEXT_PARTITION $NODES "n"
  436.           fi
  437.         elif [ "$NEXT_SYS_TYPE" = "ext3" ]; then
  438.           ask_nodes $NEXT_PARTITION
  439.           NODES="`cat $TMP/return`"
  440.           rm -f $TMP/return
  441.           if [ ! "$NODES" = "2048" -a ! "$NODES" = "1024" ]; then
  442.             NODES=4096
  443.           fi
  444.           if [ "$DOFORMAT" = "`gettext "Check"`" ]; then
  445.             make_ext3 $NEXT_PARTITION $NODES "y"
  446.           else
  447.             make_ext3 $NEXT_PARTITION $NODES "n"
  448.           fi
  449.         elif [ "$NEXT_SYS_TYPE" = "reiserfs" ]; then
  450.           make_reiserfs $NEXT_PARTITION
  451.         elif [ "$NEXT_SYS_TYPE" = "jfs" ]; then
  452.           if [ "$DOFORMAT" = "`gettext "Check"`" ]; then
  453.             make_jfs $NEXT_PARTITION "y"
  454.           else
  455.             make_jfs $NEXT_PARTITION "n"
  456.           fi
  457.         elif [ "$NEXT_SYS_TYPE" = "xfs" ]; then
  458.           make_xfs $NEXT_PARTITION
  459.         elif [ "$NEXT_SYS_TYPE" = "reiser4" ]; then
  460.           make_reiser4fs $NEXT_PARTITION
  461.         fi
  462.       fi # DOFORMAT?
  463.  
  464.       # Now ask the user where to mount this new filesystem:
  465.       dialog --backtitle "$BACKT" --title \
  466. "`gettext "SELECT MOUNT POINT FOR"` $NEXT_PARTITION" --inputbox \
  467. "`gettext -e "OK, now you need to specify where you want the new partition mounted.  \
  468. For example, if you want to put it under /usr/local, then respond:  /usr/local\n\
  469. Where would you like to mount"` $NEXT_PARTITION ?" 11 59 2> $TMP/return
  470.       if [ ! $? = 0 ]; then
  471.          continue
  472.       fi
  473.  
  474.       MTPT=`cat $TMP/return`
  475.       if [ "$MTPT" = "" ]; then # abort if blank
  476.          continue
  477.       fi
  478.       if [ "`echo "$MTPT" | cut -b1`" = " " ]; then # bail if 1st char is space
  479.          continue
  480.       fi
  481.       if [ ! "`echo "$MTPT" | cut -b1`" = "/" ]; then # add / to start of path
  482.          MTPT="/$MTPT"
  483.       fi
  484.       rm $TMP/return
  485.  
  486.       # Now, we need to mount the newly selected device:
  487.       sync
  488.       if [ ! -d /mnt/$MTPT ]; then
  489.          mkdir -p /mnt/$MTPT
  490.       fi
  491.       # If we didn't format the partition, then we don't know what fs type it is.
  492.       # So, we will try the types we know about, and let mount figure it out if all else fails:
  493.       for fs in "-t ext3" "-t ext2" "-t reiserfs" "-t jfs" "-t xfs" "-t reiser4" "" ; do
  494.         if mount $NEXT_PARTITION /mnt/$MTPT $fs 1> $REDIR 2> $REDIR ; then
  495.           break
  496.         fi
  497.         sleep 1
  498.       done
  499.       sleep 1
  500.       NEXT_SYS_TYPE=`mount | grep "^$NEXT_PARTITION on " | cut -f 5 -d ' '`
  501.       #echo "$NEXT_PARTITION       $MTPT      $NEXT_SYS_TYPE        defaults   1   1" >> $TMP/SeTnative
  502.       printf "%-16s %-16s %-11s %-16s %-3s %s\n" "$NEXT_PARTITION" "$MTPT" "$NEXT_SYS_TYPE" "defaults" "1" "2" >> $TMP/SeTnative
  503.    done # next partition loop
  504. fi # more than one Linux partition
  505.  
  506. # Done, report to the user:
  507. echo "`gettext "Adding this information to your /etc/fstab:"`" > $TMP/tempmsg
  508.  
  509. cat $TMP/SeTnative >> $TMP/tempmsg
  510. dialog --title "`gettext "DONE ADDING LINUX PARTITIONS TO /etc/fstab"`" \
  511. --exit-label OK \
  512. --textbox $TMP/tempmsg 15 75
  513.  
  514. # Now, move our /tmp storage onto the target partition if possible:
  515. /usr/lib/setup/migrate.sh
  516.