Use test(1) in a proper way

Use the correct operators to check the expected data type.

Signed-off-by: Soeren Tempel <soeren+git@soeren-tempel.net>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #3093
This commit is contained in:
Sören Tempel 2015-02-10 20:12:13 +01:00 committed by Brian Behlendorf
parent e02b533e74
commit cfbaa3c830
2 changed files with 3 additions and 3 deletions

View File

@ -22,13 +22,13 @@ case "$root" in
# Might be imported by the kernel module, so try searching before # Might be imported by the kernel module, so try searching before
# we import anything. # we import anything.
zfsbootfs=`zpool list -H -o bootfs | sed -n '/^-$/ !p' | sed 'q'` zfsbootfs=`zpool list -H -o bootfs | sed -n '/^-$/ !p' | sed 'q'`
if [ "$?" != "0" ] || [ "$zfsbootfs" = "" ] || \ if [ $? -ne 0 ] || [ -z "$zfsbootfs" ] || \
[ "$zfsbootfs" = "no pools available" ] ; then [ "$zfsbootfs" = "no pools available" ] ; then
# Not there, so we need to import everything. # Not there, so we need to import everything.
info "ZFS: Attempting to import additional pools." info "ZFS: Attempting to import additional pools."
zpool import -N -a ${ZPOOL_FORCE} zpool import -N -a ${ZPOOL_FORCE}
zfsbootfs=`zpool list -H -o bootfs | sed -n '/^-$/ !p' | sed 'q'` zfsbootfs=`zpool list -H -o bootfs | sed -n '/^-$/ !p' | sed 'q'`
if [ "$?" != "0" ] || [ "$zfsbootfs" = "" ] || \ if [ $? -ne 0 ] || [ -z "$zfsbootfs" ] || \
[ "$zfsbootfs" = "no pools available" ] ; then [ "$zfsbootfs" = "no pools available" ] ; then
rootok=0 rootok=0
pool="" pool=""

View File

@ -52,7 +52,7 @@ esac
# Make sure Dracut is happy that we have a root and will wait for ZFS # Make sure Dracut is happy that we have a root and will wait for ZFS
# modules to settle before mounting. # modules to settle before mounting.
if [ "${wait_for_zfs}" = "1" ]; then if [ ${wait_for_zfs} -eq 1 ]; then
ln -s /dev/null /dev/root 2>/dev/null ln -s /dev/null /dev/root 2>/dev/null
echo '[ -e /dev/zfs ]' > $hookdir/initqueue/finished/zfs.sh echo '[ -e /dev/zfs ]' > $hookdir/initqueue/finished/zfs.sh
fi fi