Commit 215b8a88 authored by Vitaly Lipatov's avatar Vitaly Lipatov

grf: small optimize

parent 672d0b47
...@@ -87,6 +87,10 @@ if [ "$1" = "--list" ] ; then ...@@ -87,6 +87,10 @@ if [ "$1" = "--list" ] ; then
uselist="$1" uselist="$1"
# hack for detect # hack for detect
sfile=$(cat "$uselist" | grep ^/ | head -n1) sfile=$(cat "$uselist" | grep ^/ | head -n1)
if [ -z "$sfile" ] ; then
echo "Skip empty file $uselist"
exit 0
fi
fi fi
...@@ -277,6 +281,8 @@ fi ...@@ -277,6 +281,8 @@ fi
OLDFILE= OLDFILE=
SELFILE= SELFILE=
SELHOST=
SELPATH=
if [ "$restore" = "--restore" ] ; then if [ "$restore" = "--restore" ] ; then
COUNT=1 COUNT=1
FILNUM=0 FILNUM=0
...@@ -293,8 +299,8 @@ if [ "$restore" = "--restore" ] ; then ...@@ -293,8 +299,8 @@ if [ "$restore" = "--restore" ] ; then
if opbrick "test -s" "$file" ; then if opbrick "test -s" "$file" ; then
OLDFILE="$WORKDIR/$host-$COUNT" OLDFILE="$WORKDIR/$host-$COUNT"
SELFILE="$file" SELFILE="$file"
# FIXME: overhead, but we need host and path vars SELHOST=$host
GENGFID=$(get_gfid "$SELFILE") SELPATH=$path
echo "Select OLDFILE:$OLDFILE ($file)" echo "Select OLDFILE:$OLDFILE ($file)"
fi fi
fi fi
...@@ -322,6 +328,12 @@ if [ "$restore" = "--restore" ] ; then ...@@ -322,6 +328,12 @@ if [ "$restore" = "--restore" ] ; then
if [ -n "$OLDFILE" ] ; then if [ -n "$OLDFILE" ] ; then
# get best gfid
# we need host and path vars for get_gfid
host=$SELHOST
path=$SELPATH
GENGFID=$(get_gfid "$SELFILE")
COUNT=1 COUNT=1
for i in $LISTBRICKS ; do for i in $LISTBRICKS ; do
......
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