config: Fix setting FSTYP automatically

Currently if the FSTYP is not set, the code to get FSTYP using blikd
would not work. This is because we're using HOSTOS environment variable
which might not be set (at least not on my system) and because it's
already late in the code path.

Fix this by using OSTYP environment variable as a fallback in the case
that HOSTOS does not work and move the check to common/config.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Tested-by: Filipe David Manana <fdmanana@gmail.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
Lukas Czerner
2014-04-09 09:55:52 +10:00
committed by Dave Chinner
parent 7407717466
commit e0f5daf371
2 changed files with 13 additions and 13 deletions
+13 -5
View File
@@ -297,11 +297,6 @@ _fsck_opts()
esac
}
[ -z "$FSTYP" ] && export FSTYP=xfs
[ -z "$MOUNT_OPTIONS" ] && _mount_opts
[ -z "$MKFS_OPTIONS" ] && _mkfs_opts
[ -z "$FSCK_OPTIONS" ] && _fsck_opts
known_hosts()
{
[ "$HOST_CONFIG_DIR" ] || HOST_CONFIG_DIR=`pwd`/configs
@@ -446,6 +441,19 @@ get_next_config() {
if [ -z "$CONFIG_INCLUDED" ]; then
get_next_config `echo $HOST_OPTIONS_SECTIONS | cut -f1 -d" "`
export CONFIG_INCLUDED=true
# Autodetect fs type based on what's on $TEST_DEV unless it's been set
# externally
if [ -z "$FSTYP" ] && \
[ "$HOSTOS" == "Linux" -o "$OSTYPE" == "linux-gnu" ] && \
[ ! -z "$TEST_DEV" ]; then
FSTYP=`blkid -c /dev/null -s TYPE -o value $TEST_DEV`
fi
FSTYP=${FSTYP:=xfs}
export FSTYP
[ -z "$MOUNT_OPTIONS" ] && _mount_opts
[ -z "$MKFS_OPTIONS" ] && _mkfs_opts
[ -z "$FSCK_OPTIONS" ] && _fsck_opts
fi
# make sure this script returns success