mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 14:41:31 +02:00
fix: create empty file if it does not exist
previously check_etag.sh would not create a blank file if it did not exist. The result was that the first time check_etag.sh was run it would always exit non-zero.
This commit is contained in:
parent
3e4c29957c
commit
29140526c9
@ -10,7 +10,10 @@
|
|||||||
|
|
||||||
set -e -o pipefail
|
set -e -o pipefail
|
||||||
|
|
||||||
|
# Set default release to alpha if not specified
|
||||||
release=${1:-"alpha"}
|
release=${1:-"alpha"}
|
||||||
|
|
||||||
|
# If the argument is in the form http* allow for watching an arbitrary location
|
||||||
if [[ $1 != http* ]]; then
|
if [[ $1 != http* ]]; then
|
||||||
url="http://storage.core-os.net/coreos/amd64-usr/$release/version.txt"
|
url="http://storage.core-os.net/coreos/amd64-usr/$release/version.txt"
|
||||||
else
|
else
|
||||||
@ -19,9 +22,16 @@ else
|
|||||||
fi
|
fi
|
||||||
tmplocation="/tmp/etagsync"
|
tmplocation="/tmp/etagsync"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Create file for release if it does not exist
|
||||||
|
if [ ! -f ${release}_etag ]; then
|
||||||
|
touch ${release}_etag
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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)}')
|
gawk '/ETag/ {print gensub("\"", "", "g", $2)}')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user