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 . /lib/functions/block.sh
9 . /lib/functions/fsck.sh
11 config_mount_by_section() {
13 local find_rootfs="$2"
24 local enabled_fsck="$7"
33 found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"
34 if [ -n "$found_device" ]; then
35 if [ -z "$find_rootfs" ] || [ "$find_rootfs" -eq 0 ] || [ "$is_rootfs" -eq 1 ]; then
36 [ "$enabled_fsck" -eq 1 ] && {
37 grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
38 libmount_fsck "$found_device" "$fsck_type" "$enabled_fsck"
42 [ "$is_rootfs" -eq 1 ] && [ "$find_rootfs" -eq 1 ] && {
45 config_create_mount_fstab_entry "$found_device" "$target" "$fstype" "$options" "$enabled"
46 grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
47 [ "$enabled" -eq 1 ] && mkdir -p "$target" && mount "$target" 2>&1 | tee /proc/self/fd/2 | logger -t 'fstab'
52 [ "$is_rootfs" -eq 1 ] && [ "$find_rootfs" -eq 1 ] && {
57 config_get_mount "$cfg"
61 config_swapon_by_section() {
77 found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"
79 if [ -n "$found_device" ]; then
80 config_create_swap_fstab_entry "$found_device" "$enabled"
81 grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
82 [ "$enabled" -eq 1 ] && swapon "$found_device" | tee /proc/self/fd/2 | logger -t 'fstab'
87 config_get_swap "$cfg"