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 [ -z "$find_rootfs" ] || [ "$find_rootfs" -eq 0 ] || ( [ "$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" -eq 1 ]; then
42 if [ "$is_rootfs" -eq 1 ]; then
46 if [ "$is_rootfs" -eq 1 ] || [ "$target" = "/overlay" ]; then
47 target=/tmp/overlay-disabled
51 config_create_mount_fstab_entry "$found_device" "$target" "$fstype" "$options" "$enabled"
52 grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
53 [ "$enabled" -eq 1 ] && mkdir -p "$target" && mount "$target" 2>&1 | tee /proc/self/fd/2 | logger -t 'fstab'
58 [ "$find_rootfs" -eq 1 ] && {
59 [ "$target" = "/overlay" ] && {
65 config_get_mount "$cfg"
69 config_swapon_by_section() {
84 found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"
86 if [ -n "$found_device" ]; then
87 config_create_swap_fstab_entry "$found_device" "$enabled"
88 grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
89 [ "$enabled" -eq 1 ] && swapon "$found_device" | tee /proc/self/fd/2 | logger -t 'fstab'
94 config_get_swap "$cfg"