diff --git a/check b/check index 70aa535..d1390bb 100755 --- a/check +++ b/check @@ -1,6 +1,20 @@ #!/bin/sh -exec 3>&1 -exec 1>&2 +set -e -echo "[]" >&3 +exec 3>&1 # make stdout available as fd 3 for the result +exec 1>&2 # redirect all output to stderr for logging + +PAYLOAD=$(mktemp /tmp/resource-check.XXXXXX) + +cat > "$PAYLOAD" <&0 + +TS=$(jq '.version.timestamp // empty' < "$PAYLOAD") + +if [ -z "$TS" ]; then + echo '[]' >&3 +else + jq -n "[ + { timestamp: $TS } + ]" >&3 +fi diff --git a/in b/in index 1a24852..533c0ea 100755 --- a/in +++ b/in @@ -1 +1,19 @@ #!/bin/sh + +set -e + +exec 3>&1 # make stdout available as fd 3 for the result +exec 1>&2 # redirect all output to stderr for logging + +PAYLOAD=$(mktemp /tmp/resource-in.XXXXXX) + +cat > "$PAYLOAD" <&0 + +TS=$(jq '.version.timestamp // empty' < "$PAYLOAD") +[ -z "$TS" ] && TS='"none"' + +jq -n "{ + version: { + timestamp: $TS + } +}" >&3