summaryrefslogtreecommitdiff
path: root/source/installer/sources/initrd/usr/lib/setup/SeTswap
diff options
context:
space:
mode:
authorPatrick J Volkerding <volkerdi@slackware.com>2018-06-06 22:19:01 +0000
committerEric Hameleers <alien@slackware.com>2018-06-07 08:58:09 +0200
commit6e00c56127b4fa2328e596ac18647fb7f27b674d (patch)
treed9cb5f96f79880fb29e1875aa169336346d94989 /source/installer/sources/initrd/usr/lib/setup/SeTswap
parentec4fd2d70a99a651f8498ce4c1ca8b38b9583c39 (diff)
downloadcurrent-6e00c56127b4fa2328e596ac18647fb7f27b674d.tar.gz
Wed Jun 6 22:19:01 UTC 201820180606221901
a/bash-4.4.023-x86_64-1.txz: Upgraded. a/kernel-firmware-20180604_1fa9ce3-noarch-1.txz: Upgraded. a/kernel-generic-4.14.48-x86_64-1.txz: Upgraded. a/kernel-huge-4.14.48-x86_64-1.txz: Upgraded. a/kernel-modules-4.14.48-x86_64-1.txz: Upgraded. ap/cups-2.2.8-x86_64-1.txz: Upgraded. ap/ghostscript-fonts-std-8.11-noarch-3.txz: Rebuilt. Rebuilt this and many other font packages or packages with build scripts that call mkfontdir or mkfontscale to suppress any error messages caused by collisions if another package installation is writing files to the same font directories when those utilities are run. In that case, the other package will also be running mkfontdir/mkfontscale after the files are installed, so any issues will be cleaned up then. Last one out turn off the lights, so to speak. ap/sqlite-3.24.0-x86_64-1.txz: Upgraded. ap/terminus-font-4.40-noarch-3.txz: Rebuilt. d/kernel-headers-4.14.48-x86-1.txz: Upgraded. d/rust-1.26.2-x86_64-1.txz: Upgraded. k/kernel-source-4.14.48-noarch-1.txz: Upgraded. l/elfutils-0.171-x86_64-1.txz: Upgraded. l/harfbuzz-1.7.7-x86_64-1.txz: Upgraded. l/mozilla-nss-3.37.3-x86_64-1.txz: Upgraded. l/readline-7.0.005-x86_64-1.txz: Upgraded. x/dejavu-fonts-ttf-2.37-noarch-4.txz: Rebuilt. x/font-adobe-100dpi-1.0.3-noarch-3.txz: Rebuilt. x/font-adobe-75dpi-1.0.3-noarch-3.txz: Rebuilt. x/font-adobe-utopia-100dpi-1.0.4-noarch-3.txz: Rebuilt. x/font-adobe-utopia-75dpi-1.0.4-noarch-3.txz: Rebuilt. x/font-adobe-utopia-type1-1.0.4-noarch-3.txz: Rebuilt. x/font-arabic-misc-1.0.3-noarch-3.txz: Rebuilt. x/font-bh-100dpi-1.0.3-noarch-3.txz: Rebuilt. x/font-bh-75dpi-1.0.3-noarch-3.txz: Rebuilt. x/font-bh-lucidatypewriter-100dpi-1.0.3-noarch-3.txz: Rebuilt. x/font-bh-lucidatypewriter-75dpi-1.0.3-noarch-3.txz: Rebuilt. x/font-bh-ttf-1.0.3-noarch-3.txz: Rebuilt. x/font-bh-type1-1.0.3-noarch-3.txz: Rebuilt. x/font-bitstream-100dpi-1.0.3-noarch-3.txz: Rebuilt. x/font-bitstream-75dpi-1.0.3-noarch-3.txz: Rebuilt. x/font-bitstream-speedo-1.0.2-noarch-3.txz: Rebuilt. x/font-bitstream-type1-1.0.3-noarch-3.txz: Rebuilt. x/font-cronyx-cyrillic-1.0.3-noarch-3.txz: Rebuilt. x/font-cursor-misc-1.0.3-noarch-3.txz: Rebuilt. x/font-daewoo-misc-1.0.3-noarch-3.txz: Rebuilt. x/font-dec-misc-1.0.3-noarch-3.txz: Rebuilt. x/font-ibm-type1-1.0.3-noarch-3.txz: Rebuilt. x/font-isas-misc-1.0.3-noarch-3.txz: Rebuilt. x/font-jis-misc-1.0.3-noarch-3.txz: Rebuilt. x/font-micro-misc-1.0.3-noarch-3.txz: Rebuilt. x/font-misc-cyrillic-1.0.3-noarch-3.txz: Rebuilt. x/font-misc-ethiopic-1.0.3-noarch-3.txz: Rebuilt. x/font-misc-meltho-1.0.3-noarch-3.txz: Rebuilt. x/font-misc-misc-1.1.2-noarch-3.txz: Rebuilt. x/font-mutt-misc-1.0.3-noarch-3.txz: Rebuilt. x/font-schumacher-misc-1.1.2-noarch-3.txz: Rebuilt. x/font-screen-cyrillic-1.0.4-noarch-3.txz: Rebuilt. x/font-sony-misc-1.0.3-noarch-3.txz: Rebuilt. x/font-sun-misc-1.0.3-noarch-3.txz: Rebuilt. x/font-winitzki-cyrillic-1.0.3-noarch-3.txz: Rebuilt. x/font-xfree86-type1-1.0.4-noarch-3.txz: Rebuilt. x/liberation-fonts-ttf-2.00.1-noarch-3.txz: Rebuilt. x/libinput-1.11.0-x86_64-1.txz: Upgraded. x/sazanami-fonts-ttf-20040629-noarch-3.txz: Rebuilt. x/sinhala_lklug-font-ttf-20060929-noarch-3.txz: Rebuilt. x/tibmachuni-font-ttf-1.901b-noarch-3.txz: Rebuilt. x/ttf-indic-fonts-0.5.14-noarch-3.txz: Rebuilt. x/ttf-tlwg-0.6.4-noarch-3.txz: Rebuilt. x/urw-core35-fonts-otf-20170801_91edd6e_git-noarch-2.txz: Rebuilt. x/wqy-zenhei-font-ttf-0.8.38_1-noarch-6.txz: Rebuilt. xap/mozilla-firefox-60.0.2-x86_64-1.txz: Upgraded. This release contains security fixes and improvements. For more information, see: https://www.mozilla.org/security/known-vulnerabilities/firefox.html (* Security fix *) xap/x3270-3.3.12ga7-x86_64-5.txz: Rebuilt. isolinux/initrd.img: Rebuilt. kernels/*: Upgraded. usb-and-pxe-installers/usbboot.img: Rebuilt.
Diffstat (limited to 'source/installer/sources/initrd/usr/lib/setup/SeTswap')
-rwxr-xr-xsource/installer/sources/initrd/usr/lib/setup/SeTswap122
1 files changed, 122 insertions, 0 deletions
diff --git a/source/installer/sources/initrd/usr/lib/setup/SeTswap b/source/installer/sources/initrd/usr/lib/setup/SeTswap
new file mode 100755
index 00000000..f9eb52fc
--- /dev/null
+++ b/source/installer/sources/initrd/usr/lib/setup/SeTswap
@@ -0,0 +1,122 @@
+#!/bin/sh
+
+TMP=/var/log/setup/tmp
+if [ ! -d $TMP ]; then
+ mkdir -p $TMP
+fi
+REDIR=/dev/tty4
+NDIR=/dev/null
+
+crunch() {
+ read STRING;
+ echo $STRING;
+}
+
+# get_part_size( dev ) - Return the size in K, M, G, T, or P of the named partition.
+get_part_size() {
+ numfmt --to=iec $(blockdev --getsize64 $1)
+}
+
+rm -f $TMP/SeTswap $TMP/SeTswapskip $TMP/SeTuseswap $TMP/tmpscript
+
+SWAPLIST="`probe -l 2> /dev/null | grep "Linux swap" | cut -f 1 -d ' ' | sort 2> $NDIR`"
+
+if [ "$SWAPLIST" = "" ]; then
+ dialog --title "NO SWAP SPACE DETECTED" --yesno "You have not created \
+a swap partition with Linux fdisk. \
+Do you want to continue installing without one? " 6 60
+ if [ "$?" = "1" ]; then
+ dialog --title "ABORTING INSTALLATION" --msgbox "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:
+ cat << EOF > $TMP/tmpscript
+dialog --backtitle "Setting up swap partitions." \\
+--title "SWAP SPACE DETECTED" --checklist \\
+"Slackware 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." \\
+0 0 0 \\
+EOF
+ for swappartition in $SWAPLIST ; do
+ PARTSIZE=$(get_part_size $swappartition)
+ cat << EOF >> $TMP/tmpscript
+"$swappartition" "Linux swap partition, ${PARTSIZE}" on \\
+EOF
+ done
+ cat << EOF >> $TMP/tmpscript
+ 2> $TMP/SeTuseswap
+EOF
+ . $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 "Setting up swap partitions." \
+ --title "CHECK SWAP PARTITIONS FOR BAD BLOCKS?" --defaultno --yesno \
+"Slackware 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?" \
+10 60
+ 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
+ echo "Activating swap partition ${swappartition}:"
+ 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 1
+
+ # 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
+
+ echo "Your swapspace has been configured. This information will" > $TMP/swapmsg
+ echo "be added to your /etc/fstab:" >> $TMP/swapmsg
+ echo >> $TMP/swapmsg
+ cat $TMP/SeTswap >> $TMP/swapmsg
+ dialog --title "SWAP SPACE CONFIGURED" --exit-label OK --textbox $TMP/swapmsg 10 72
+ rm $TMP/swapmsg
+ fi
+fi