tests: simplify find_vfstab_dev()
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12979
This commit is contained in:
parent
a67a187335
commit
e0c5a48b3f
|
@ -36,28 +36,13 @@
|
||||||
#
|
#
|
||||||
function find_vfstab_dev
|
function find_vfstab_dev
|
||||||
{
|
{
|
||||||
typeset vfstabdev
|
|
||||||
typeset vfstabdevs=""
|
|
||||||
typeset line
|
|
||||||
|
|
||||||
if is_illumos; then
|
if is_illumos; then
|
||||||
vfstab="/etc/vfstab"
|
vfstab="/etc/vfstab"
|
||||||
tmpfile="$TEST_BASE_DIR/vfstab.tmp"
|
|
||||||
else
|
else
|
||||||
vfstab="/etc/fstab"
|
vfstab="/etc/fstab"
|
||||||
tmpfile="$TEST_BASE_DIR/fstab.tmp"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat $vfstab | grep "^${DEV_DSKDIR}" >$tmpfile
|
awk -v pat="^${DEV_DSKDIR}" '$0 ~ pat {sub(/:$/, "", $1); print $1}' $vfstab
|
||||||
while read -r line
|
|
||||||
do
|
|
||||||
vfstabdev=`echo "$line" | awk '{print $1}'`
|
|
||||||
vfstabdev=${vfstabdev%%:}
|
|
||||||
vfstabdevs="$vfstabdev $vfstabdevs"
|
|
||||||
done <$tmpfile
|
|
||||||
|
|
||||||
rm -f $tmpfile
|
|
||||||
echo $vfstabdevs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -69,28 +69,13 @@ function create_blockfile
|
||||||
#
|
#
|
||||||
function find_vfstab_dev
|
function find_vfstab_dev
|
||||||
{
|
{
|
||||||
typeset vfstabdev
|
|
||||||
typeset vfstabdevs=""
|
|
||||||
typeset line
|
|
||||||
|
|
||||||
if is_illumos; then
|
if is_illumos; then
|
||||||
vfstab="/etc/vfstab"
|
vfstab="/etc/vfstab"
|
||||||
tmpfile="$TEST_BASE_DIR/vfstab.tmp"
|
|
||||||
else
|
else
|
||||||
vfstab="/etc/fstab"
|
vfstab="/etc/fstab"
|
||||||
tmpfile="$TEST_BASE_DIR/fstab.tmp"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat $vfstab | grep "^${DEV_DSKDIR}" >$tmpfile
|
awk -v pat="^${DEV_DSKDIR}" '$0 ~ pat {sub(/:$/, "", $1); print $1}' $vfstab
|
||||||
while read -r line
|
|
||||||
do
|
|
||||||
vfstabdev=`echo "$line" | awk '{print $1}'`
|
|
||||||
vfstabdev=${vfstabdev%%:}
|
|
||||||
vfstabdevs="$vfstabdev $vfstabdevs"
|
|
||||||
done <$tmpfile
|
|
||||||
|
|
||||||
rm -f $tmpfile
|
|
||||||
echo $vfstabdevs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue