Gentoo-Upgrade/sbin/gentoo-fetchcommand.sh

29 lines
617 B
Bash
Raw Normal View History

2012-05-18 20:27:25 +04:00
#!/bin/bash
2013-09-12 01:09:45 +04:00
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 "======= 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
echo "======= FULL DOWNLOAD... ======"
2013-09-12 01:09:45 +04:00
/usr/bin/wget -t1 --passive-ftp $@
exit $?
fi
2012-05-18 20:27:25 +04:00
fi
2013-09-12 01:09:45 +04:00
exit -1
2012-05-18 20:27:25 +04:00