2 # Copyright 2010 Vertical Communications
3 # This is free software, licensed under the GNU General Public License v2.
4 # See /LICENSE for more information.
8 pi_include /lib/functions/block.sh
9 pi_include /lib/functions/fsck.sh
11 config_mount_by_section() {
13 local find_rootfs="$2"
24 local enabled_fsck="$7"
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"
41 if [ "$find_rootfs" = "1" ]; then
42 if [ "$is_rootfs" -eq 1 ]; then
44 elif [ "$target" = "/" ]; then
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"
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'
62 [ "$find_rootfs" = "1" ] && {
63 [ "$target" = "/overlay" ] && {
66 [ "$target" = "/rom" ] && {
72 config_get_mount "$cfg"
76 config_swapon_by_section() {
91 found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"
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'
101 config_get_swap "$cfg"