btrfs: add hostonly check

master
Harald Hoyer 2010-07-21 14:25:42 +02:00
parent 6baa63110e
commit dcdca91d91
1 changed files with 13 additions and 1 deletions

View File

@ -1,10 +1,22 @@
#!/bin/bash

# We depend on udev-rules being loaded
[ "$1" = "-d" ] && exit 0
[[ "$1" = "-d" ]] && exit 0

# if we don't have btrfs (btrfsctl) installed on the host system,
# no point in trying to support it in the initramfs.
which btrfsctl >/dev/null 2>&1 || exit 1

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

is_btrfs() { get_fs_type /dev/block/$1 |grep -q btrfs; }

if [[ "$1" = "-h" ]]; then
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
is_btrfs "$rootdev" || exit 1
fi
fi

exit 0