From 588fadded55c6d808b5a2b076da87d32a7b885e6 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 15 Oct 2010 23:20:15 -0400 Subject: Use systemd's support for normal swapon; only handle autoswap here. --- Makefile | 2 +- systemd/fedora-autoswap | 18 ++++++++++++++++++ systemd/fedora-swapon | 20 -------------------- systemd/system/fedora-autoswap.service | 13 +++++++++++++ systemd/system/fedora-swapon.service | 13 ------------- 5 files changed, 32 insertions(+), 34 deletions(-) create mode 100755 systemd/fedora-autoswap delete mode 100755 systemd/fedora-swapon create mode 100644 systemd/system/fedora-autoswap.service delete mode 100644 systemd/system/fedora-swapon.service diff --git a/Makefile b/Makefile index 4ead51da..cef2f9a7 100644 --- a/Makefile +++ b/Makefile @@ -127,7 +127,7 @@ install: mkdir -p -m 755 $(ROOT)/lib/systemd/system/sysinit.target.wants ln -s ../fedora-configure.service $(ROOT)/lib/systemd/system/basic.target.wants ln -s ../fedora-loadmodules.service $(ROOT)/lib/systemd/system/basic.target.wants - ln -s ../fedora-swapon.service $(ROOT)/lib/systemd/system/basic.target.wants + ln -s ../fedora-autoswap.service $(ROOT)/lib/systemd/system/basic.target.wants ln -s ../fedora-sysinit-hack.service $(ROOT)/lib/systemd/system/basic.target.wants ln -s ../fedora-cleanup.service $(ROOT)/lib/systemd/system/local-fs.target.wants ln -s ../fedora-mountall.service $(ROOT)/lib/systemd/system/local-fs.target.wants 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 diff --git a/systemd/fedora-swapon b/systemd/fedora-swapon deleted file mode 100755 index 98c5b273..00000000 --- a/systemd/fedora-swapon +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Start up swap (partitions and files) -# - -. /etc/init.d/functions - -update_boot_stage RCswap -action $"Enabling /etc/fstab swaps: " swapon -a -e -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 diff --git a/systemd/system/fedora-autoswap.service b/systemd/system/fedora-autoswap.service new file mode 100644 index 00000000..c5087967 --- /dev/null +++ b/systemd/system/fedora-autoswap.service @@ -0,0 +1,13 @@ +[Unit] +Description=Enable all detected swap partitions +DefaultDependencies=no +Conflicts=shutdown.target +Before=shutdown.target emergency.service emergency.target +After=fedora-mountall.service fedora-init-crypto-3.service +Requires=fedora-mountall.service fedora-init-crypto-3.service + +[Service] +ExecStart=/lib/systemd/fedora-autoswap +Type=oneshot +TimeoutSec=0 +RemainAfterExit=yes diff --git a/systemd/system/fedora-swapon.service b/systemd/system/fedora-swapon.service deleted file mode 100644 index 4b945026..00000000 --- a/systemd/system/fedora-swapon.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Configure the system if the administrator requested it -DefaultDependencies=no -Conflicts=shutdown.target -Before=shutdown.target emergency.service emergency.target -After=fedora-mountall.service fedora-init-crypto-3.service -Requires=fedora-mountall.service fedora-init-crypto-3.service - -[Service] -ExecStart=/lib/systemd/fedora-swapon -Type=oneshot -TimeoutSec=0 -RemainAfterExit=yes -- cgit v1.2.1