Commit 7ce850e4 authored by Vitaly Lipatov's avatar Vitaly Lipatov

improve grf

parent e3141ed2
#!/bin/sh
LOCKFILE=$0.lock
test -r $LOCKFILE && echo "Already running..." && exit
touch $LOCKFILE
# Проверяет указанный файл на наличие в возможных местах размещения
fatal()
{
echo "FATAL: $@" >&2
rm -f $LOCKFILE
exit 1
}
......@@ -28,6 +33,7 @@ umount_g()
umount -v "$MOUNTDIR/$host/$path"
rmdir "$MOUNTDIR/$host/$path"
done
rm -f $LOCKFILE
}
mount_g()
......@@ -115,6 +121,7 @@ if [ "$1" = "--list" ] ; then
sfile=$(cat "$uselist" | grep ^/ | head -n1)
if [ -z "$sfile" ] ; then
echo "Skip empty file $uselist"
rm -f $LOCKFILE
exit 0
fi
fi
......@@ -182,7 +189,7 @@ fi
get_pgf_name()
{
local rfile="$1"
echo ".glusterfs/$(echo $rfile | cut -b1-2)/$(echo $rfile | cut -b3-4)/$rfile"
echo ".glusterfs/$(echo "$rfile" | cut -b1-2)/$(echo "$rfile" | cut -b3-4)/$rfile"
}
tr_gfid_to_rpath()
......@@ -200,8 +207,8 @@ tr_gfid_to_rpath()
# hack: translate to a path on volume
file="$(echo "$sfile" | sed -e "s|$FTPROOT/||g")"
rfile=$(echo $file | sed -e "s|<gfid:||g" | sed -e "s|[<>]||g")
rfile=$(get_pgf_name $rfile)
rfile=$(echo "$file" | sed -e "s|<gfid:||g" | sed -e "s|[<>]||g")
rfile=$(get_pgf_name "$rfile")
rpath=$path
rfile=$(opbrick "realpath" "$rfile") && break
done
......@@ -468,7 +475,7 @@ if [ -n "$uselist" ] ; then
done
else
# TODO: use find?
for sf in $sfile ; do
for sf in "$sfile" ; do
test_file "$sf"
done
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment