Since different distros may or may not use vol_id in udev, and blkid
is generally replacing vol_id, abstract them out into a function which
tries to use vol_id first and blkid second, on the assumption that
blkid can take over for vol_id if vol_id is no longer there.
[[ -w $dracutlogfile ]] && echo "E: $@" >>"$dracutlogfile"
}
+get_fs_type() (
+ if [[ -x /lib/udev/vol_id ]]; then
+ eval /usr/udev/vol_id --export $1
+ echo $ID_FS_TYPE
+ elif find_binary >/dev/null; then
+ blkid -o value -s TYPE $1
+ else
+ return 1
+ fi
+)
+
# finds the major:minor of the block device backing the root filesystem.
find_root_block_device() {
local rootdev blkdev fs type opts misc
. $dracutfunctions
-is_crypt() { /lib/udev/vol_id /dev/block/$1 |grep -q crypto_LUKS; }
+is_crypt() { [[ $(get_fs_type /dev/block/$1) = crypto_LUKS ]]; }
[[ $1 = '-h' ]] && {
rootdev=$(find_root_block_device)
. $dracutfunctions
-is_dmraid() { /lib/udev/vol_id /dev/block/$1 |grep -v linux_raid_member | \
+is_dmraid() { get_fs_type /dev/block/$1 |grep -v linux_raid_member | \
grep -q _raid_member; }
[[ $1 = '-h' ]] && {
. $dracutfunctions
-is_lvm() { /lib/udev/vol_id /dev/block/$1 |grep -q LVM2_member; }
+is_lvm() { [[ $(get_fs_type /dev/block/$1) = LVM2_member ]]; }
[[ $1 = '-h' ]] && {
rootdev=$(find_root_block_device)
check_block_and_slaves is_lvm "$rootdev" || exit 1
else
# root is not on a block device, use the shotgun approach
- blkid | grep -q lvm2pv || exit 1
+ blkid | grep -q LVM2_member || exit 1
fi
}
. $dracutfunctions
-is_mdraid() { /lib/udev/vol_id /dev/block/$1 |egrep -q '(linux|isw)_raid'; }
+is_mdraid() { get_fs_type /dev/block/$1 |egrep -q '(linux|isw)_raid'; }
[[ $1 = '-h' ]] && {
rootdev=$(find_root_block_device)