kdump-lib.sh: introduce a helper to get underlying crypt device
Resolves: bz1951415
Upstream: fedora
Conflict: None
commit 3423bbc17f
Author: Kairui Song <kasong@redhat.com>
Date: Thu Apr 8 01:36:49 2021 +0800
kdump-lib.sh: introduce a helper to get underlying crypt device
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Pingfan Liu <piliu@redhat.com>
Signed-off-by: Kairui Song <kasong@redhat.com>
This commit is contained in:
parent
de11ebc0b7
commit
ccdd4f2894
17
kdump-lib.sh
17
kdump-lib.sh
@ -939,3 +939,20 @@ kdump_get_arch_recommend_size()
|
||||
echo $result
|
||||
return 0
|
||||
}
|
||||
|
||||
# Print all underlying crypt devices of a block device
|
||||
# print nothing if device is not on top of a crypt device
|
||||
# $1: the block device to be checked in maj:min format
|
||||
get_luks_crypt_dev()
|
||||
{
|
||||
[[ -b /dev/block/$1 ]] || return 1
|
||||
|
||||
local _type=$(eval "$(blkid -u filesystem,crypto -o export -- /dev/block/$1); echo \$TYPE")
|
||||
[[ $_type == "crypto_LUKS" ]] && echo $1
|
||||
|
||||
for _x in /sys/dev/block/$1/slaves/*; do
|
||||
[[ -f $_x/dev ]] || continue
|
||||
[[ $_x/subsystem -ef /sys/class/block ]] || continue
|
||||
get_luks_crypt_dev "$(< "$_x/dev")"
|
||||
done
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user