Skip to content

Commit d62db20

Browse files
committed
feat(iam): install IAM cache from latest release
1 parent 69c4dd9 commit d62db20

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

exordos/images/install.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,43 @@ sudo cp "$GC_PATH/etc/exordos_core/logging.yaml" $GC_CFG_DIR/
147147
sudo mkdir -p $GC_CFG_DIR/exordos_core.d
148148
sudo cp "$GC_PATH/exordos/images/bootstrap.sh" $BOOTSTRAP_PATH/0100-ec-bootstrap.sh
149149

150+
# Install the latest released IAM cache through its standalone installer.
151+
IAM_CACHE_REPO=https://github.com/exordos/iam-cache.git
152+
IAM_CACHE_DIR=$(mktemp -d)
153+
cleanup_iam_cache() {
154+
rm -rf -- "$IAM_CACHE_DIR"
155+
}
156+
trap cleanup_iam_cache EXIT
157+
158+
git clone --depth 1 "$IAM_CACHE_REPO" "$IAM_CACHE_DIR"
159+
case "$(dpkg --print-architecture)" in
160+
amd64|arm64)
161+
IAM_CACHE_ARCH=$(dpkg --print-architecture)
162+
;;
163+
*)
164+
echo "Unsupported architecture for the IAM cache: $(dpkg --print-architecture)" >&2
165+
exit 1
166+
;;
167+
esac
168+
169+
IAM_CACHE_DOWNLOAD_URL=$(curl -fsSL https://api.github.com/repos/exordos/iam-cache/releases/latest \
170+
| grep -oE '"browser_download_url"[[:space:]]*:[[:space:]]*"[^"]+"' \
171+
| cut -d '"' -f 4 \
172+
| grep -E ".*linux[-_]${IAM_CACHE_ARCH}$" \
173+
| head -n 1)
174+
if [[ -z "$IAM_CACHE_DOWNLOAD_URL" ]]; then
175+
echo "No Linux ${IAM_CACHE_ARCH} IAM cache binary found in the latest release." >&2
176+
exit 1
177+
fi
178+
179+
IAM_CACHE_BINARY="$IAM_CACHE_DIR/exordos-iam-cache"
180+
curl -fsSLo "$IAM_CACHE_BINARY" "$IAM_CACHE_DOWNLOAD_URL"
181+
chmod 0755 "$IAM_CACHE_BINARY"
182+
sudo "$IAM_CACHE_DIR/scripts/install.sh" "$IAM_CACHE_BINARY"
183+
184+
cleanup_iam_cache
185+
trap - EXIT
186+
150187
cd "$GC_PATH"
151188
uv sync
152189
source "$GC_PATH"/.venv/bin/activate

0 commit comments

Comments
 (0)