1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2007 OpenWrt.org
8 config_get fstype
"$cfg" fstype
9 fstype
="${fstype:-auto}"
10 config_get options
"$cfg" options
11 options
="${options:-rw}"
12 config_get device
"$cfg" device
13 [ -n "device" ] ||
return 0
14 config_get target
"$cfg" target
15 [ -n "target" ] ||
return 0
17 config_get_bool enabled
"$cfg" "enabled" '1'
18 [ "$enabled" -gt 0 ] && {
19 /bin
/mount
-t $fstype -o $options $device $target
25 config_get device
"$cfg" device
26 [ -n "device" ] ||
return 0
27 config_get_bool enabled
"$cfg" "enabled" '1'
28 [ "$enabled" -gt 0 ] && [ -x /usr
/sbin
/swapon
] && {
29 /usr
/sbin
/swapon
$device
35 config_get target
"$cfg" target
36 [ -n "target" ] ||
return 0
37 config_get_bool enabled
"$cfg" "enabled" '1'
38 [ "$enabled" -gt 0 ] && {
45 config_get device
"$cfg" device
46 [ -n "device" ] ||
return 0
47 config_get_bool enabled
"$cfg" "enabled" '1'
48 [ "$enabled" -gt 0 ] && [ -x /usr
/sbin
/swapoff
] && {
49 /usr
/sbin
/swapoff
$device
55 config_foreach do_mount mount
56 config_foreach do_swapon swap
61 config_foreach do_unmount mount
62 config_foreach do_swapoff swap