Add all btrfs devices
We have to find them with "btrfs usage", which is cumbersome.master
parent
78362bc5fe
commit
1cadc26fd4
|
@ -31,6 +31,10 @@ strstr() { [[ $1 = *"$2"* ]]; }
|
|||
strglobin() { [[ $1 = *$2* ]]; }
|
||||
# Generic glob matching function. If glob pattern $2 matches all of $1, OK
|
||||
strglob() { [[ $1 = $2 ]]; }
|
||||
# returns OK if $1 contains literal string $2 at the beginning, and isn't empty
|
||||
str_starts() { [ "${1#"$2"*}" != "$1" ]; }
|
||||
# returns OK if $1 contains literal string $2 at the end, and isn't empty
|
||||
str_ends() { [ "${1%*"$2"}" != "$1" ]; }
|
||||
|
||||
# helper function for check() in module-setup.sh
|
||||
# to check for required installed binaries
|
||||
|
@ -1815,3 +1819,12 @@ lvm_internal_dev() {
|
|||
[[ ${DM_LV_LAYER} ]] || [[ ! -L /dev/${DM_VG_NAME}/${DM_LV_NAME} ]]
|
||||
}
|
||||
|
||||
btrfs_devs() {
|
||||
local _mp="$1"
|
||||
btrfs device usage "$_mp" \
|
||||
| while read _dev _rest; do
|
||||
str_starts "$_dev" "/" || continue
|
||||
_dev=${_dev%,}
|
||||
printf -- "%s\n" "$_dev"
|
||||
done
|
||||
}
|
||||
|
|
22
dracut.sh
22
dracut.sh
|
@ -1146,6 +1146,11 @@ for line in "${fstab_lines[@]}"; do
|
|||
;;
|
||||
esac
|
||||
[ -z "$dev" ] && dwarn "Bad fstab entry $@" && continue
|
||||
if [[ "$3" == btrfs ]]; then
|
||||
for i in $(btrfs_devs "$2"); do
|
||||
push_host_devs "$i"
|
||||
done
|
||||
fi
|
||||
push_host_devs "$dev"
|
||||
host_fs_types["$dev"]="$3"
|
||||
done
|
||||
|
@ -1194,8 +1199,14 @@ if [[ $hostonly ]]; then
|
|||
_bdev=$(readlink -f "/dev/block/$_dev")
|
||||
[[ -b $_bdev ]] && _dev=$_bdev
|
||||
push_host_devs $_dev
|
||||
[[ "$mp" == "/" ]] && root_dev="$_dev"
|
||||
[[ "$mp" == "/" ]] && push root_devs "$_dev"
|
||||
push_host_devs "$_dev"
|
||||
if [[ $(find_mp_fstype "$mp") == btrfs ]]; then
|
||||
for i in $(btrfs_devs "$mp"); do
|
||||
[[ "$mp" == "/" ]] && push root_devs "$i"
|
||||
push_host_devs "$i"
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
|
||||
|
@ -1240,7 +1251,14 @@ if [[ $hostonly ]]; then
|
|||
[[ "$_o" != *x-initrd.mount* ]] && continue
|
||||
_dev=$(expand_persistent_dev "$_d")
|
||||
_dev="$(readlink -f "$_dev")"
|
||||
[[ -b $_dev ]] && push_host_devs "$_dev"
|
||||
[[ -b $_dev ]] || continue
|
||||
|
||||
push_host_devs "$_dev"
|
||||
if [[ "$_t" == btrfs ]]; then
|
||||
for i in $(find_btrfs_devs "$_m"); do
|
||||
push_host_devs "$i"
|
||||
done
|
||||
fi
|
||||
done < /etc/fstab
|
||||
fi
|
||||
|
||||
|
|
|
@ -102,7 +102,9 @@ install() {
|
|||
. "$moddir/dracut-lib.sh"
|
||||
|
||||
for _dev in ${host_devs[@]}; do
|
||||
[[ "$_dev" == "$root_dev" ]] && continue
|
||||
for _dev2 in ${root_devs[@]}; do
|
||||
[[ "$_dev" == "$_dev2" ]] && continue 2
|
||||
done
|
||||
|
||||
# We only actually wait for real devs - swap is only needed
|
||||
# for resume and udev rules generated when parsing resume=
|
||||
|
|
Loading…
Reference in New Issue