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" -eq 0 ] && options
="noauto,$options"
19 echo "$device $target $fstype $options 0 0" >> /tmp
/fstab
24 config_get device
"$cfg" device
25 [ -n "$device" ] ||
return 0
26 config_get_bool enabled
"$cfg" "enabled" '1'
27 [ "$enabled" -gt 0 ] && {
28 echo "$device none swap ${noauto}sw 0 0" >> /tmp
/fstab
34 config_get target
"$cfg" target
35 [ -n "$target" ] ||
return 0
36 config_get_bool enabled
"$cfg" "enabled" '1'
37 [ "$enabled" -gt 0 ] && {
44 config_get device
"$cfg" device
45 [ -n "$device" ] ||
return 0
46 config_get_bool enabled
"$cfg" "enabled" '1'
47 [ "$enabled" -gt 0 ] && type swapoff
>/dev
/null
&& {
54 echo '# WARNING: this is an auto generated file, please use uci to set static filesystems' > /tmp
/fstab
55 config_foreach do_mount mount
56 config_foreach do_swapon swap
58 [ -x /sbin
/swapon
] && swapon
-a
63 config_foreach do_unmount mount
64 config_foreach do_swapoff swap