aboutsummaryrefslogtreecommitdiffstats
path: root/systemd/fedora-autoswap
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2010-10-15 23:20:15 -0400
committerBill Nottingham <notting@redhat.com>2010-10-15 23:20:15 -0400
commit588fadded55c6d808b5a2b076da87d32a7b885e6 (patch)
tree85ca64e72adadd015b49160c528299981cdb22bc /systemd/fedora-autoswap
parent2d238bd89255740f308f51a50b4cfae2c713293f (diff)
downloadinitscripts-588fadded55c6d808b5a2b076da87d32a7b885e6.tar
initscripts-588fadded55c6d808b5a2b076da87d32a7b885e6.tar.gz
initscripts-588fadded55c6d808b5a2b076da87d32a7b885e6.tar.bz2
initscripts-588fadded55c6d808b5a2b076da87d32a7b885e6.tar.xz
initscripts-588fadded55c6d808b5a2b076da87d32a7b885e6.zip
Use systemd's support for normal swapon; only handle autoswap here.initscripts-9.21.systemd-1
Diffstat (limited to 'systemd/fedora-autoswap')
-rwxr-xr-xsystemd/fedora-autoswap18
1 files changed, 18 insertions, 0 deletions
diff --git a/systemd/fedora-autoswap b/systemd/fedora-autoswap
new file mode 100755
index 00000000..ea392909
--- /dev/null
+++ b/systemd/fedora-autoswap
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# Support automatic swapon.
+#
+
+. /etc/init.d/functions
+
+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