#!/bin/sh export TEXTDOMAIN=slint LANG=$( $NDIR`" if [ "$SWAPLIST" = "" ]; then dialog --title "`gettext "NO SWAP SPACE DETECTED"`" --yesno "`gettext "You have not created \ a swap partition with Linux fdisk. \ Do you want to continue installing without one? "`" 7 80 if [ "$?" = "1" ]; then dialog --title "`gettext "ABORTING INSTALLATION"`" --msgbox "`gettext "Create a swap partition with Linux fdisk, and then try this again."`" \ 6 40 else touch $TMP/SeTswapskip fi exit else # there is at least one swap partition: # Build the swap partition selection menu: echo -n 'dialog --visit-items --backtitle "' > $TMP/tmpscript gettext "Setting up swap partitions." >> $TMP/tmpscript echo -n '" --title "' >> $TMP/tmpscript gettext "SWAP SPACE DETECTED" >> $TMP/tmpscript echo -n '" --checklist "' >> $TMP/tmpscript gettext "Slint Setup has detected one or more swap \ partitions on your system. These partitions have been \ preselected to be set up as swap space. If there are any \ swap partitions that you \ do not wish to use with this installation, please unselect \ them with the up and down arrows and spacebar. If you wish \ to use all of them (this is recommended), simply hit \ the ENTER key." >> $TMP/tmpscript echo -n '" 0 0 0 ' >> $TMP/tmpscript for swappartition in $SWAPLIST ; do PARTSIZE=$(get_part_size $swappartition) echo -n "$swappartition" >> $TMP/tmpscript echo -n ' "' >> $TMP/tmpscript eval_gettext "Linux swap partition, \${PARTSIZE}" >> $TMP/tmpscript echo -n '" on ' >> $TMP/tmpscript done echo -n ' 2> $TMP/SeTuseswap' >> $TMP/tmpscript . $TMP/tmpscript if [ ! $? = 0 ]; then rm -f $TMP/tmpscript $TMP/SeTswap $TMP/SeTuseswap touch $TMP/SeTswapskip fi if [ -r $TMP/SeTuseswap ]; then # Remove extra quotes from SeTuseswap, if any: cat $TMP/SeTuseswap | tr -d \" > $TMP/SeTfoo mv $TMP/SeTfoo $TMP/SeTuseswap # Were any swap partitions asked for? if [ "$(cat $TMP/SeTuseswap)" = "" -a ! -r $TMP/SeTswapskip ]; then rm -f $TMP/tmpscript $TMP/SeTswap $TMP/SeTuseswap touch $TMP/SeTswapskip fi fi if [ ! -r $TMP/SeTswapskip ]; then dialog --backtitle "`gettext "Setting up swap partitions."`" \ --title "`gettext "CHECK SWAP PARTITIONS FOR BAD BLOCKS?"`" --defaultno --yesno \ "`gettext "Slint Setup will now prepare your system's swap space. \ When formatting swap partitions with mkswap you may also check \ them for bad blocks. This is not the default since nearly all \ modern hard drives check themselves for bad blocks anyway. \ Would you like to check for bad blocks while running mkswap?"`" \ 0 0 if [ $? = 0 ]; then CHECKBAD=yes else CHECKBAD=no fi # Run mkswap on swap partitions, unless they are already in use: for swappartition in $(cat $TMP/SeTuseswap) ; do if ! grep -w $swappartition /proc/swaps 1> $REDIR 2> $REDIR ; then if [ "$CHECKBAD" = "no" ]; then mkswap -v1 $swappartition 1> $REDIR 2> $REDIR else mkswap -c -v1 $swappartition 1> $REDIR 2> $REDIR fi eval_gettext "Activating swap partition \${swappartition}:" echo echo "swapon ${swappartition}" swapon $swappartition 1> $REDIR 2> $REDIR fi done # This is so people don't ask what that output was that flashed # by on the screen. ;-) sleep 2 # Add the swap partitions to the file that will go into /etc/fstab: for swappartition in $(cat $TMP/SeTuseswap) ; do printf "%-16s %-16s %-11s %-16s %-3s %s\n" "$swappartition" "swap" "swap" "defaults" "0" "0" >> $TMP/SeTswap done gettext "Your swapspace has been configured. This information \ will be added to your /etc/fstab:" > $TMP/swapmsg echo >> $TMP/swapmsg echo >> $TMP/swapmsg cat $TMP/SeTswap >> $TMP/swapmsg dialog --title "`gettext "SWAP SPACE CONFIGURED"`" --exit-label OK --no-collapse --msgbox "` cat $TMP/swapmsg`" 11 80 rm $TMP/swapmsg fi fi