mirror of
https://gitlab.com/jarylc/docker-duoauthproxy.git
synced 2026-02-06 08:22:57 +00:00
dynamically select Alpine version with correct Python version pin
This commit is contained in:
29
check.sh
29
check.sh
@@ -1,28 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
apk add curl jq
|
||||
apk add curl jq htmlq
|
||||
|
||||
[[ ! -f EXISTING ]] || touch EXISTING
|
||||
EXISTING=$(cat EXISTING)
|
||||
echo "Existing: ${EXISTING}"
|
||||
|
||||
if [[ -n $OVERWRITE ]]; then
|
||||
echo "Overwriting: $OVERWRITE"
|
||||
LATEST=$OVERWRITE
|
||||
else
|
||||
INFO=$(curl https://duo.com/docs/checksums | grep 'https://dl.duosecurity.com/duoauthproxy' | grep 'src.tgz' | rev | cut -d'>' -f1 | rev)
|
||||
CHECKSUM=$(echo "$INFO" | cut -d' ' -f1)
|
||||
LATEST=$(echo "$INFO" | cut -d'-' -f2)
|
||||
PYTHON_VERSION=$(curl https://duo.com/docs/authproxy-notes | grep -Eo 'Python to \d+\.\d+\.\d+' | head -n1 | rev | cut -d' ' -f1 | rev)
|
||||
echo "Latest: ${LATEST}"
|
||||
echo "Checksum: ${CHECKSUM}"
|
||||
echo "Python Version: ${PYTHON_VERSION}"
|
||||
fi
|
||||
INFO=$(curl https://duo.com/docs/checksums | grep 'https://dl.duosecurity.com/duoauthproxy' | grep 'src.tgz' | rev | cut -d'>' -f1 | rev)
|
||||
CHECKSUM=$(echo "$INFO" | cut -d' ' -f1)
|
||||
LATEST=$(echo "$INFO" | cut -d'-' -f2)
|
||||
PYTHON_VERSION=$(curl https://duo.com/docs/authproxy-notes | grep -Eo 'Python to \d+\.\d+\.\d+' | head -n1 | rev | cut -d' ' -f1 | rev)
|
||||
for ALPINE_VERSION in $(curl -s "https://pkgs.alpinelinux.org/packages?name=python${PYTHON_VERSION%.*.*}" | htmlq -w --text 'select#branch > option' | grep -v 'Branch' | grep -v 'edge' | tac | xargs); do
|
||||
if curl -s "https://pkgs.alpinelinux.org/packages?name=python${PYTHON_VERSION%.*.*}&branch=${ALPINE_VERSION}" | grep -q ${PYTHON_VERSION%.*}; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Latest: ${LATEST}"
|
||||
echo "Checksum: ${CHECKSUM}"
|
||||
echo "Python Version: ${PYTHON_VERSION}"
|
||||
echo "Alpine Version: ${ALPINE_VERSION}"
|
||||
|
||||
if [[ (-n "${LATEST}" && "${LATEST}" != "${EXISTING}") ]]; then
|
||||
mv build.template.yml build.yml
|
||||
sed -i "s \$CHECKSUM ${CHECKSUM} g" 'build.yml'
|
||||
sed -i "s \$LATEST ${LATEST} g" 'build.yml'
|
||||
sed -i "s \$PYTHON_VERSION ${PYTHON_VERSION} g" 'build.yml'
|
||||
sed -i "s \$ALPINE_VERSION ${ALPINE_VERSION} g" 'build.yml'
|
||||
echo "Building..."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user