diff options
author | Youness Alaoui <kakaroto@kakaroto.homelinux.net> | 2016-04-01 23:09:20 +0300 |
---|---|---|
committer | Youness Alaoui <kakaroto@kakaroto.homelinux.net> | 2016-04-01 23:09:20 +0300 |
commit | 724f0d121810cd5595a2d0331ec9896c84bd5944 (patch) | |
tree | e9a58ec1736c220415a12cae245d1a2256d3f6e4 | |
parent | 629b983bd4f1ae215ec947ae971897f85d09b183 (diff) |
Fix package.sh file size because of Location redirects, the size could be wrong
-rwxr-xr-x | package.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/package.sh b/package.sh index 84e14c18a7..96bc0e9482 100755 --- a/package.sh +++ b/package.sh @@ -62,11 +62,11 @@ function downloadURL filename=`basename "$1"` echo "Checking for $filename" if [ -f "$filename" ]; then - SERVER_SIZE=$(curl -L -I "$1" | grep Content-Length | awk '{ sub(/\r$/,""); print $2}') + FILE_SIZE=$(stat -c%s "$filename") + SERVER_SIZE=$(curl -L -I "$1" | grep Content-Length | awk '{ sub(/\r$/,""); print $2}' | tail -n 1) + echo "File $filename exists with $FILE_SIZE bytes. Server version has $SERVER_SIZE bytes" if [ "x$SERVER_SIZE" != "x" ]; then if [ "$SERVER_SIZE" -gt 0 ]; then - FILE_SIZE=$(stat -c%s "$filename") - echo "File $filename exists with $FILE_SIZE bytes. Server version has $SERVER_SIZE bytes" if [ "$FILE_SIZE" -ne "$SERVER_SIZE" ]; then rm -f "$filename" fi |