Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYouness Alaoui <kakaroto@kakaroto.homelinux.net>2016-03-31 16:55:56 +0300
committerYouness Alaoui <kakaroto@kakaroto.homelinux.net>2016-03-31 17:46:20 +0300
commit9156c89caf7f31a74ed87648228f15706ce8adcd (patch)
tree13946e569121ece42ad297301d30a16839721a7b
parent4be7422cabae64c143181e1e4a162cde4a5a4b84 (diff)
package.sh: When downloading files, if file exists, check that it has the right size
If a file was not downloaded correctly, this caused an issue where it would never try to redownload it. This should fix it (not tested properly though)
-rwxr-xr-xpackage.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/package.sh b/package.sh
index 4bf7fa2a82..05bdc43eb2 100755
--- a/package.sh
+++ b/package.sh
@@ -63,6 +63,14 @@ function downloadURL
{
filename=`basename "$1"`
echo "Checking for $filename"
+ if [ -f "$filename" ]; then
+ SERVER_SIZE=$(curl -L -I "$1" | grep Content-Length | awk '{print $2}')
+ FILE_SIZE=$(stat -c%s "$filename")
+ echo "File $filename exists with $FILE_SIZE bytes. Server version has $SERVER_SIZE bytes"
+ if [ "$FILE_SIZE" != "$SERVER_SIZE" ]; then
+ rm -f "$filename"
+ fi
+ fi
if [ ! -f "$filename" ]; then
echo "Downloading $1"
curl -L -O "$1"