mirror of
git://f0xx.org/ac/ac-deploy
synced 2026-07-29 10:39:00 +03:00
ShortLinksRepository mail pack + renderQrPng; cluster APK includes libqrencode-tools; deploy-ac-url-shortener ensures QR CLI. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1.1 KiB
Bash
Executable File
31 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# Deploy ac-ms-url-shortener (replaces monolith submodule path on lab nodes).
|
|
set -eu
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
# shellcheck source=/dev/null
|
|
. "$ROOT/scripts/lib/common.sh"
|
|
load_cluster_env
|
|
|
|
URL_ROOT="${URL_SHORTENER_ROOT:-/var/www/url-shortener}"
|
|
ORIGIN="${URL_SHORTENER_ORIGIN:-git://f0xx.org/ac/ac-ms-url-shortener}"
|
|
BRANCH="${AC_GIT_BRANCH:-next}"
|
|
|
|
mkdir -p "$(dirname "$URL_ROOT")"
|
|
git config --global --add safe.directory "$URL_ROOT" 2>/dev/null || true
|
|
|
|
if [ -d "${URL_ROOT}/.git" ]; then
|
|
log "url-shortener pull ${BRANCH}"
|
|
git -C "$URL_ROOT" fetch origin
|
|
git -C "$URL_ROOT" checkout "$BRANCH"
|
|
git -C "$URL_ROOT" pull --ff-only origin "$BRANCH" || git -C "$URL_ROOT" reset --hard "origin/${BRANCH}"
|
|
else
|
|
log "url-shortener clone ${ORIGIN}"
|
|
rm -rf "$URL_ROOT"
|
|
git clone --branch "$BRANCH" --depth 1 "$ORIGIN" "$URL_ROOT"
|
|
fi
|
|
|
|
apk add --no-cache libqrencode libqrencode-tools >/dev/null 2>&1 || true
|
|
|
|
chown -R nginx:nginx "$URL_ROOT" 2>/dev/null || true
|
|
log "deploy-ac-url-shortener_ok $(host_short) $(git -C "$URL_ROOT" rev-parse --short HEAD)"
|