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 ]; 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 [ "$is_rootfs" -eq 1 ] && [ "$find_rootfs" -eq 1 ] && {
44 config_create_mount_fstab_entry "$found_device" "$target" "$fstype" "$options" "$enabled"
45 grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
46 [ "$enabled" -eq 1 ] && mkdir -p "$target" && mount "$target" 2>&1 | tee /proc/self/fd/2 | logger -t 'fstab'
51 [ "$is_rootfs" -eq 1 ] && [ "$find_rootfs" -eq 1 ] && {
56 config_get_mount "$cfg"
60 config_swapon_by_section() {
75 found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"
77 if [ -n "$found_device" ]; then
78 config_create_swap_fstab_entry "$found_device" "$enabled"
79 grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
80 [ "$enabled" -eq 1 ] && swapon "$found_device" | tee /proc/self/fd/2 | logger -t 'fstab'
85 config_get_swap "$cfg"