[package] kmod-libertas needs kmod-lib80211 to load
[openwrt.git] / package / base-files / files / etc / init.d / fstab
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2007 OpenWrt.org
3
4 START=20
5
6 do_mount() {
7 local cfg="$1"
8
9 config_get device "$cfg" device
10 config_get target "$cfg" target
11 [ -n "$device" -a -n "$target" ] || return 0
12
13 mkdir -p $target
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
19 }
20
21 do_swapon() {
22 local cfg="$1"
23
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
28 }
29
30 do_unmount() {
31 local cfg="$1"
32
33 config_get target "$cfg" target
34 config_get_bool enabled "$cfg" "enabled" '1'
35 [ -n "$target" -a "$enabled" -gt 0 ] || return 0
36 umount $target
37 }
38
39 do_swapoff() {
40 local cfg="$1"
41
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
45 swapoff $device
46 }
47
48 start() {
49 config_load fstab
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
53 mount -a
54 [ -x /sbin/swapon ] && swapon -a
55 }
56
57 stop() {
58 config_load fstab
59 config_foreach do_unmount mount
60 config_foreach do_swapoff swap
61 [ -x /sbin/swapoff ] && swapoff -a
62 }
63
This page took 0.058679 seconds and 5 git commands to generate.