blob: 1fa07f734ee244f878a376cba72d524cc61bf261 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
dracutfunctions=/usr/lib/dracut/dracut-functions
hostonly=1
check() {
local _rootdev _usrdev _needed
# No point trying to support lvm if the binaries are missing
type -P lvm >/dev/null || return 1
. $dracutfunctions
[[ $debug ]] && set -x
is_lvm() { [[ $(get_fs_type /dev/block/$1) = LVM2_member ]]; }
[[ $hostonly ]] && {
_rootdev=$(find_root_block_device)
if [[ $_rootdev ]]; then
# root lives on a block device, so we can be more precise about
# hostonly checking
echo "Checking / via $_rootdev"
check_block_and_slaves is_lvm "$_rootdev" && _needed=1
else
# root is not on a block device, use the shotgun approach
blkid | grep -q LVM2_member && _needed=1
fi
[[ $_needed ]] || {
_usrdev=$(find_block_device /usr)
if [[ $_usrdev ]]; then
echo "Checking /usr via $_usrdev"
check_block_and_slaves is_lvm "$_usrdev" && _needed=1
fi
}
}
echo "_needed=$_needed"
[[ $_needed ]]
}
check
echo $?
|