1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2007 OpenWrt.org
9 config_get device "$cfg" device
10 config_get target "$cfg" target
11 [ -n "$device" -a -n "$target" ] || return 0
14 config_get fstype "$cfg" fstype 'auto'
15 config_get options "$cfg" options '-rw'
16 config_get_bool enabled "$cfg" "enabled" '1'
17 [ "$enabled" -eq 0 ] && options="noauto,$options"
18 echo "$device $target $fstype $options 0 0" >> /tmp/fstab
24 config_get device "$cfg" device
25 config_get_bool enabled "$cfg" "enabled" '1'
26 [ -n "$device" -a "$enabled" -gt 0 ] || return 0
27 echo "$device none swap sw 0 0" >> /tmp/fstab
33 config_get target "$cfg" target
34 config_get_bool enabled "$cfg" "enabled" '1'
35 [ -n "$target" -a "$enabled" -gt 0 ] || return 0
42 config_get device "$cfg" device
43 config_get_bool enabled "$cfg" "enabled" '1'
44 [ -n "$device" -a "$enabled" -gt 0 ] && type swapoff >/dev/null || return 0
50 echo '# WARNING: this is an auto generated file, please use uci to set static filesystems' > /tmp/fstab
51 config_foreach do_mount mount
52 config_foreach do_swapon swap
54 [ -x /sbin/swapon ] && swapon -a
59 config_foreach do_unmount mount
60 config_foreach do_swapoff swap
61 [ -x /sbin/swapoff ] && swapoff -a