#!/bin/bash

# We depend on udev-rules being loaded
[[ "$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
