#!/usr/bin/env bash ### Bash Environment Setup # http://redsymbol.net/articles/unofficial-bash-strict-mode/ # https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html set -o errexit set -o errtrace set -o nounset set -o pipefail IFS=$'\n' REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )" cd "$REPO_DIR" ABXPKG_LIB_DIR="${ABXPKG_LIB_DIR:-${LIB_DIR:-$HOME/.config/archivebox/lib}}" ABXPKG_SPEC="$(UV_LOCK_PATH="$REPO_DIR/uv.lock" uv run --no-cache --no-project python -c 'import os, tomllib; package = next(item for item in tomllib.load(open(os.environ["UV_LOCK_PATH"], "rb"))["package"] if item["name"] == "abxpkg"); wheel = package["wheels"][0]; print("abxpkg @ {}#{}".format(wheel["url"], wheel["hash"].replace(":", "=")))')" mkdir -p "$ABXPKG_LIB_DIR/env/bin" uv run --no-cache --no-project --with "$ABXPKG_SPEC" abxpkg env \ --install \ --lib="$ABXPKG_LIB_DIR" \ --deps-from="$REPO_DIR/.github/configs/ci-tooling.json:git_binaries" \ >/dev/null GIT_BINARY="$ABXPKG_LIB_DIR/env/bin/git" test -x "$GIT_BINARY" if [[ "$("$GIT_BINARY" branch --show-current)" != "dev" ]]; then echo "[X] Run this from the dev branch." >&2 exit 1 fi if [[ -n "$("$GIT_BINARY" status --porcelain)" ]]; then echo "[X] Refusing to update a dirty worktree." >&2 "$GIT_BINARY" status --short >&2 exit 1 fi "$GIT_BINARY" pull --ff-only