gentoo-fetchcommand script updated

This commit is contained in:
Kolan Sh 2013-09-12 01:09:45 +04:00
parent 19fec29f51
commit 8df4b7e9b3
1 changed files with 23 additions and 7 deletions

View File

@ -1,12 +1,28 @@
#!/bin/bash
DEST_FILE=`echo $@ | sed 's~.* ~~g'`
/usr/bin/getdelta.sh "$@"
if [ ! -f "$DEST_FILE" ]; then
echo "======= FULL DOWNLOAD... ======"
echo "======= PARAMS: $@ ======"
/usr/bin/wget -t1 --passive-ftp $@
echo "======= PARAMS: $@ ======"
URL=`echo $@ | awk '{print $1}'`
DEST_FILE=`echo $@ | awk '{print $3}'`
/usr/bin/getdelta.sh $URL
if [ -f "$DEST_FILE" ]; then
exit 0
else
echo "======= FULL DOWNLOAD... ======"
echo "======= PARAMS: $@ ======"
URL_FNAME=${URL##*/}
DEST_FILE_DIR=${DEST_FILE%/*}
if [[ ! -z "$URL_FNAME" && ! -z "${DEST_FILE##*/}"
&& ! -z "$DEST_FILE_DIR" && -f ${DEST_FILE%/*}/$URL_FNAME ]]; then
echo --- MOVING $URL_FNAME TO ${DEST_FILE##*/} ---
mv -f $DEST_FILE_DIR/$URL_FNAME $DEST_FILE
exit $?
else
/usr/bin/wget -t1 --passive-ftp $@
exit $?
fi
fi
exit 0
exit -1