mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-09 05:56:58 +02:00
Merge pull request #577 from dit4c/fix-check-etag
Force HTTP/1.0 in fix_check_etag.sh
This commit is contained in:
commit
7dcf071100
@ -2,14 +2,14 @@
|
|||||||
# check_etag.sh
|
# check_etag.sh
|
||||||
#
|
#
|
||||||
# A tool for monitoring remote files and acting if the file has changed
|
# A tool for monitoring remote files and acting if the file has changed
|
||||||
# This tool has been optimized for use on CoreOS but should work
|
# This tool has been optimized for use on CoreOS but should work
|
||||||
# for most files where an ETag is exposed.
|
# for most files where an ETag is exposed.
|
||||||
|
|
||||||
# by default we retrieve the alpha image, set to a different value to retrieve
|
# by default we retrieve the alpha image, set to a different value to retrieve
|
||||||
# that release
|
# that release
|
||||||
|
|
||||||
set -e -o pipefail
|
set -e -o pipefail
|
||||||
|
|
||||||
# Set default release to alpha if not specified
|
# Set default release to alpha if not specified
|
||||||
release=${1:-"alpha"}
|
release=${1:-"alpha"}
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ else
|
|||||||
release=$(echo ${url} | sed -e 's/http:\/\///1' -e 's/\//-/g' )
|
release=$(echo ${url} | sed -e 's/http:\/\///1' -e 's/\//-/g' )
|
||||||
fi
|
fi
|
||||||
tmplocation="/tmp/etagsync"
|
tmplocation="/tmp/etagsync"
|
||||||
|
|
||||||
# Create location for storage of CoreOS image state
|
# Create location for storage of CoreOS image state
|
||||||
mkdir -p ${tmplocation}
|
mkdir -p ${tmplocation}
|
||||||
pushd ${tmplocation} > /dev/null 2>&1
|
pushd ${tmplocation} > /dev/null 2>&1
|
||||||
@ -32,11 +32,11 @@ if [ ! -f ${release}_etag ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Retrieve the remote etag header
|
# Retrieve the remote etag header
|
||||||
remote_etag=$(curl -I ${url} -k -s | \
|
remote_etag=$(curl -I ${url} -k -s | \
|
||||||
gawk '/ETag/ {print gensub("\"", "", "g", $2)}')
|
grep -i '^etag:' | sed -e 's/.*: *//' -e 's/["\r\n]//g')
|
||||||
|
|
||||||
source ${release}_etag > /dev/null 2>&1
|
source ${release}_etag > /dev/null 2>&1
|
||||||
|
|
||||||
if [ "$remote_etag" == "$local_etag" ]; then
|
if [ "$remote_etag" == "$local_etag" ]; then
|
||||||
echo "Everything is current"
|
echo "Everything is current"
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user