[imagebuilder] use --force-run-hooks for host opkg install
[openwrt.git] / package / block-mount / files / fstab.init
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.
6 #
7
8
9 START=20
10
11 . /lib/functions/mount.sh
12
13 do_mount() {
14 local cfg="$1"
15 config_mount_by_section "$cfg"
16 }
17
18 do_swapon() {
19 local cfg="$1"
20 config_swapon_by_section "$cfg"
21 }
22
23 do_unmount() {
24 local cfg="$1"
25
26 config_get target "$cfg" target
27 config_get_bool enabled "$cfg" "enabled" '1'
28 [ -n "$target" -a "$enabled" -gt 0 ] || return 0
29 umount $target
30 }
31
32 do_swapoff() {
33 local cfg="$1"
34
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
38 swapoff $device
39 }
40
41 start() {
42 config_load fstab
43 mkdir -p /var/lock
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
48 }
49 lock -u /var/lock/fstab.lck
50 }
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
54 }
55
56 stop() {
57 config_load fstab
58 config_foreach do_unmount mount
59 config_foreach do_swapoff swap
60 swapoff -a
61 }
62
This page took 0.06235 seconds and 5 git commands to generate.