File: check

package info (click to toggle)
dracut 005-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,368 kB
  • ctags: 207
  • sloc: sh: 6,487; ansic: 192; makefile: 108
file content (26 lines) | stat: -rwxr-xr-x 631 bytes parent folder | download
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
#!/bin/bash

# We depend on dm_mod being loaded
[ "$1" = "-d" ] && echo dm

# No point trying to support lvm if the binaries are missing
which lvm >/dev/null 2>&1 || exit 1

. $dracutfunctions
[[ $debug ]] && set -x

is_lvm() { [[ $(get_fs_type /dev/block/$1) = LVM2_member ]]; }

[[ $1 = '-h' ]] && {
    rootdev=$(find_root_block_device)
    if [[ $rootdev ]]; then
	# root lives on a block device, so we can be more precise about 
	# hostonly checking
	check_block_and_slaves is_lvm "$rootdev" || exit 1
    else
	# root is not on a block device, use the shotgun approach
	blkid | grep -q LVM2_member || exit 1
    fi
}

exit 0