mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-06-08 01:18:32 +08:00
Compare sizes
This commit is contained in:
parent
c7adb59134
commit
c5e18b5fd9
@ -34,22 +34,20 @@ function downloadUpdate {
|
|||||||
TMP="/tmp/agent.sh"
|
TMP="/tmp/agent.sh"
|
||||||
rm -f "${TMP}"
|
rm -f "${TMP}"
|
||||||
|
|
||||||
SCRIPT=$(readlink -f ${BASH_SOURCE[0]})
|
|
||||||
URL="https://raw.githubusercontent.com/kroese/virtual-dsm/master/agent/agent.sh"
|
|
||||||
|
|
||||||
# Auto update the agent
|
# Auto update the agent
|
||||||
|
|
||||||
remote_size=$(curl -s -I -k -m 3 "${URL}" | grep -i "content-length:" | tr -d " \t" | cut -d ':' -f 2)
|
URL="https://raw.githubusercontent.com/kroese/virtual-dsm/master/agent/agent.sh"
|
||||||
local_size=$(stat -c%s "$SCRIPT")
|
remote_size=$(curl -sIk -m 3 "${URL}" | grep -i "content-length:" | tr -d " \t" | cut -d ':' -f 2)
|
||||||
|
|
||||||
echo "local size: $local_size"
|
|
||||||
echo "remote size: $remote_size"
|
|
||||||
|
|
||||||
[ "$remote_size" == "" ] && return
|
[ "$remote_size" == "" ] && return
|
||||||
[ "$remote_size" == "0" ] && return
|
[ "$remote_size" == "0" ] && return
|
||||||
|
|
||||||
|
SCRIPT=$(readlink -f ${BASH_SOURCE[0]})
|
||||||
|
local_size=$(stat -c%s "$SCRIPT")
|
||||||
|
|
||||||
[ "$remote_size" == "$local_size" ] && return
|
[ "$remote_size" == "$local_size" ] && return
|
||||||
|
|
||||||
if ! curl -s -f -k -m 10 -o "${TMP}" "${URL}"; then
|
if ! curl -sfk -m 10 -o "${TMP}" "${URL}"; then
|
||||||
echo "$HEADER: curl error" && return
|
echo "$HEADER: curl error" && return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user