Cache Steam runtime SDKs in their own subdirs
#!/usr/bin/env bash
+# Usage example: $0 master soldier 0.20210618.0
set -u
if [ $# -eq 2 ]; then
@@ -11,9 +12,12 @@ BRANCH="${1:-master}"
# soldier 0.20201022.1 or newer
# scout 0.20201104.0 or newer
RUNTIME="${2:-soldier}"
-VERSION="${3:-0.20201022.1}"
-IMAGE="steamrt_${RUNTIME}_amd64:mango-${VERSION}"
+VERSION="${3:-0.20210618.0}"
+IMAGE="steamrt_${RUNTIME}_${VERSION}_amd64:mango-${RUNTIME}"
BASEURL="https://repo.steampowered.com/steamrt-images-${RUNTIME}/snapshots/${VERSION}"
+CACHEDIR="./cache/steamrt-images-${RUNTIME}/snapshots/${VERSION}"
+
+mkdir -p "${CACHEDIR}"
echo -e "\e[1mBuilding branch \e[92m${BRANCH}\e[39m using \e[92m${RUNTIME}:${VERSION}\e[39m runtime\e[0m"
@@ -23,8 +27,8 @@ if ! docker inspect --type=image ${IMAGE} 2>&1 >/dev/null ; then
mkdir -p ./cache/empty
sed "s/%RUNTIME%/${RUNTIME}/g" steamrt.Dockerfile.in > ./cache/steamrt.Dockerfile
- wget -P ./cache -c ${BASEURL}/com.valvesoftware.SteamRuntime.Sdk-amd64,i386-${RUNTIME}-sysroot.tar.gz
- cp --reflink=always "./cache/com.valvesoftware.SteamRuntime.Sdk-amd64,i386-${RUNTIME}-sysroot.tar.gz" ./cache/empty/
+ wget -P "${CACHEDIR}" -c ${BASEURL}/com.valvesoftware.SteamRuntime.Sdk-amd64,i386-${RUNTIME}-sysroot.tar.gz
+ cp --reflink=always "${CACHEDIR}/com.valvesoftware.SteamRuntime.Sdk-amd64,i386-${RUNTIME}-sysroot.tar.gz" ./cache/empty/
docker build -f ./cache/steamrt.Dockerfile -t ${IMAGE} ./cache/empty
fi
