diff options
author | rwhitby <rwhitby@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2007-09-22 13:47:20 +0000 |
---|---|---|
committer | rwhitby <rwhitby@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2007-09-22 13:47:20 +0000 |
commit | 23bfa7ede33e280bb0c2f9aebda14c12d9f1503d (patch) | |
tree | 973d2d9e9f2ab02b2b6a6b1e5e39403acab04332 /package/base-files/files/etc/init.d/fstab | |
parent | bcf744cef673a3381ab827226cab009253df223f (diff) |
base-files: Added support for swap configuration in /etc/config/fstab
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8947 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files/etc/init.d/fstab')
-rwxr-xr-x | package/base-files/files/etc/init.d/fstab | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/package/base-files/files/etc/init.d/fstab b/package/base-files/files/etc/init.d/fstab index 2a63a5b1bf..b96e0c8a54 100755 --- a/package/base-files/files/etc/init.d/fstab +++ b/package/base-files/files/etc/init.d/fstab @@ -20,6 +20,16 @@ do_mount() { } } +do_swapon() { + local cfg="$1" + config_get device "$cfg" device + [ -n "device" ] || return 0 + config_get_bool enabled "$cfg" "enabled" '1' + [ "$enabled" -gt 0 ] && [ -x /usr/sbin/swapon ] && { + /usr/sbin/swapon $device + } +} + do_unmount() { local cfg="$1" config_get target "$cfg" target @@ -30,13 +40,25 @@ do_unmount() { } } +do_swapoff() { + local cfg="$1" + config_get device "$cfg" device + [ -n "device" ] || return 0 + config_get_bool enabled "$cfg" "enabled" '1' + [ "$enabled" -gt 0 ] && [ -x /usr/sbin/swapoff ] && { + /usr/sbin/swapoff $device + } +} + start() { config_load fstab config_foreach do_mount mount + config_foreach do_swapon swap } stop() { config_load fstab config_foreach do_unmount mount + config_foreach do_swapoff swap } |