aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d/rcS.d/270-autoswap.sh
diff options
context:
space:
mode:
Diffstat (limited to 'rc.d/rcS.d/270-autoswap.sh')
-rwxr-xr-xrc.d/rcS.d/270-autoswap.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/rc.d/rcS.d/270-autoswap.sh b/rc.d/rcS.d/270-autoswap.sh
new file mode 100755
index 00000000..e7ce922e
--- /dev/null
+++ b/rc.d/rcS.d/270-autoswap.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+[[ $(type -t strstr) = "function" ]] || . /etc/init.d/functions
+
+# Start up swapping.
+if [ "$AUTOSWAP" = "yes" ]; then
+ curswap=$(awk '/^\/dev/ { print $1 }' /proc/swaps | while read x; do get_numeric_dev dec $x ; echo -n " "; done)
+ swappartitions=$(blkid -t TYPE=swap -o device)
+ if [ x"$swappartitions" != x ]; then
+ for partition in $swappartitions ; do
+ [ ! -e $partition ] && continue
+ majmin=$(get_numeric_dev dec $partition)
+ echo $curswap | grep -qw "$majmin" || action $"Enabling local swap partitions: " swapon $partition
+ done
+ fi
+fi
+: