ar71xx: disable unused file system drivers in the nand subtarget
[openwrt.git] / package / block-mount / files / mount.sh
1 #!/bin/sh
2 # Copyright 2010 Vertical Communications
3 # This is free software, licensed under the GNU General Public License v2.
4 # See /LICENSE for more information.
5 #
6
7
8 pi_include /lib/functions/block.sh
9 pi_include /lib/functions/fsck.sh
10
11 config_mount_by_section() {
12 local cfg="$1"
13 local find_rootfs="$2"
14
15 mount_cb() {
16 local cfg="$1"
17 local device="$2"
18 shift
19 local target="$2"
20 local cfgdevice="$3"
21 local fstype="$4"
22 local options="$5"
23 local enabled="$6"
24 local enabled_fsck="$7"
25 local uuid="$8"
26 local label="$9"
27 shift
28 local is_rootfs="$9"
29 shift
30 local found_device=""
31
32 found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"
33 if [ -n "$found_device" ]; then
34 if [ "$find_rootfs" != "1" ] || ( [ "$is_rootfs" -eq 1 ] || [ "$target" = "/" ] || [ "$target" = "/overlay" ] ); then
35 [ "$enabled_fsck" -eq 1 ] && {
36 grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
37 libmount_fsck "$found_device" "$fstype" "$enabled_fsck"
38 }
39 }
40
41 if [ "$find_rootfs" = "1" ]; then
42 if [ "$is_rootfs" -eq 1 ]; then
43 target=/overlay
44 elif [ "$target" = "/" ]; then
45 target=/rom
46 fi
47 else
48 if [ "$is_rootfs" -eq 1 ] || [ "$target" = "/overlay" ]; then
49 target=/tmp/overlay-disabled
50 elif [ "$target" = "/" ] || [ "$target" = "/rom" ]; then
51 target="/tmp/whole_root-disabled"
52 fi
53 fi
54
55 config_create_mount_fstab_entry "$found_device" "$target" "$fstype" "$options" "$enabled"
56 grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
57 [ "$enabled" -eq 1 ] && mkdir -p "$target" && mount "$target" 2>&1 | tee /proc/self/fd/2 | logger -t 'fstab'
58 }
59
60 fi
61 fi
62 [ "$find_rootfs" = "1" ] && {
63 [ "$target" = "/overlay" ] && {
64 rootfs_found=1
65 }
66 [ "$target" = "/rom" ] && {
67 rootfs_found=1
68 }
69 }
70 return 0
71 }
72 config_get_mount "$cfg"
73 reset_block_cb
74 }
75
76 config_swapon_by_section() {
77 local cfg="$1"
78
79 swap_cb() {
80 local cfg="$1"
81 local device="$2"
82 local cfgdevice="$3"
83 local enabled="$4"
84 local uuid="$5"
85 local label="$6"
86 local uuid
87 local label
88
89 local found_device=""
90
91 found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"
92
93 if [ -n "$found_device" ]; then
94 config_create_swap_fstab_entry "$found_device" "$enabled"
95 grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
96 [ "$enabled" -eq 1 ] && swapon "$found_device" | tee /proc/self/fd/2 | logger -t 'fstab'
97 }
98 fi
99 return 0
100 }
101 config_get_swap "$cfg"
102 reset_block_cb
103 }
This page took 0.050215 seconds and 5 git commands to generate.