1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2007 OpenWrt.org
3 # Copyright (C) 2010 Vertical Communications
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
11 .
/lib
/functions
/mount.sh
15 config_mount_by_section
"$cfg"
20 config_swapon_by_section
"$cfg"
26 config_get target
"$cfg" target
27 config_get_bool enabled
"$cfg" "enabled" '1'
28 [ -n "$target" -a "$enabled" -gt 0 ] ||
return 0
35 config_get device
"$cfg" device
36 config_get_bool enabled
"$cfg" "enabled" '1'
37 [ -n "$device" -a "$enabled" -gt 0 ] && type swapoff
>/dev
/null ||
return 0
44 lock
-w /var
/lock
/fstab.lck
&& {
45 lock
/var
/lock
/fstab.lck
46 [ -e /tmp
/fstab
] ||
{
47 echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /tmp
/fstab
49 lock
-u /var
/lock
/fstab.lck
51 config_foreach do_swapon swap
52 config_foreach do_mount mount
53 config_foreach do_swapon swap
# do swap a second time so that swap on filesystems is enabled
58 config_foreach do_unmount mount
59 config_foreach do_swapoff swap