From: Arkadiusz Miƛkiewicz Date: Sun, 23 Oct 2011 10:34:03 +0000 (+0000) Subject: - move tmpfile handling outside of lftp X-Git-Tag: auto/th/rpm-build-tools-4.5-3~16^2~12 X-Git-Url: http://git.pld-linux.org/?p=packages%2Frpm-build-tools.git;a=commitdiff_plain;h=2830c943ce5e64b68caa36d670ef3906b6c0687d - move tmpfile handling outside of lftp Changed files: builder.sh -> 1.658 --- diff --git a/builder.sh b/builder.sh index 584e482..2f759b9 100644 --- a/builder.sh +++ b/builder.sh @@ -192,9 +192,15 @@ elif [ -n "$USE_AXEL" ]; then OUTFILEOPT="-o" elif [ -n "$USE_LFTP" ]; then download_lftp() { + local url outfile retval url="$1" outfile="$2" - lftp -c "set net:max-retries $WGET_RETRIES; set http:user-agent \"$USER_AGENT\"; pget -n 10 -c \"$url\" -o \"$outfile.tmp\" && local mv \"$outfile.tmp\" \"$outfile\" || local rm -f \"$outfile.tmp\"" + lftp -c "set net:max-retries $WGET_RETRIES; set http:user-agent \"$USER_AGENT\"; pget -n 10 -c \"$url\" -o \"$outfile.tmp\"" + if [ $? -eq 0 ]; then + mv -f "$outfile.tmp" "$outfile" + else + rm -f "$outfile.tmp" + fi } GETURI=download_lftp GETURI2=$GETURI