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.
13 config_mount_by_section "$cfg"
18 config_swapon_by_section "$cfg"
24 config_get target "$cfg" target
25 config_get_bool enabled "$cfg" "enabled" '1'
26 [ -n "$target" -a "$enabled" -gt 0 ] || return 0
33 config_get device "$cfg" device
34 config_get_bool enabled "$cfg" "enabled" '1'
35 [ -n "$device" -a "$enabled" -gt 0 ] && type swapoff >/dev/null || return 0
40 . /lib/functions/mount.sh
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
57 . /lib/functions/mount.sh
60 config_foreach do_unmount mount
61 config_foreach do_swapoff swap