Files
quick-qrcode-generator/verifier/qrverify.sh

29 lines
520 B
Bash
Raw Permalink Normal View History

#!/bin/bash
#
# EP should contain the hostname?
# If passing it is impossible, maybe we should interrogate Ingress resource?
#
# uuidgen comes from util-linux, zbarimg from zbar
set -e
DATA=$(uuidgen)
TMPFILE=$(mktemp --suffix .png)
echo "➡️ Checking ${EP} with data: ${DATA}"
curl --verbose "http://${EP}/render/?data=${DATA}" --output ${TMPFILE}
DECODED=$(zbarimg --quiet ${TMPFILE})
if [ "QR-Code:${DATA}" != "${DECODED}" ]; then
echo "❌ Error, got ${DECODED}"
exit 1
else
echo "✅ OK!"
fi
exit 0