Files
SuperminarenandClaude Sonnet 5.5 5caca05738 Add local Docker deployment and submodules
- docker-compose.yml: builder, nginx web server and a LaTeX container (profile "latex")
  for regenerating the SVG drawings
- Makefile, scripts/fetch.sh, .env.example
- 50ohm, 50ohm-contents-dl and 50ohm-ansible as submodules tracking branch sv

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-10 15:03:28 +02:00

37 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Fetch (or update) the three repos this deployment is built from.
#
# scripts/fetch.sh clone/init the submodules, check out and fast-forward branch "sv" in each
# scripts/fetch.sh --pinned check out exactly the commits recorded in this repo (detached HEAD)
#
# Also adds the original DARC repos as the local-only remote "upstream", so upstream changes
# can be pulled in with `git fetch upstream`.
set -euo pipefail
cd "$(dirname "$0")/.."
BRANCH=sv
declare -A UPSTREAM=(
[50ohm]=https://github.com/DARC-e-V/50ohm.git
[50ohm-contents-dl]=https://github.com/DARC-e-V/50ohm-contents-dl.git
[50ohm-ansible]=https://github.com/DARC-e-V/50ohm-ansible.git
)
git submodule sync --quiet
git submodule update --init
for repo in "${!UPSTREAM[@]}"; do
if ! git -C "$repo" remote | grep -qx upstream; then
git -C "$repo" remote add upstream "${UPSTREAM[$repo]}"
echo "$repo: added remote upstream"
fi
if [[ "${1:-}" != "--pinned" ]]; then
git -C "$repo" fetch --quiet origin
git -C "$repo" checkout --quiet "$BRANCH"
git -C "$repo" merge --quiet --ff-only "origin/$BRANCH" || echo "$repo: $BRANCH has local commits, not fast-forwarded"
fi
echo "$repo: $(git -C "$repo" rev-parse --abbrev-ref HEAD) @ $(git -C "$repo" rev-parse --short HEAD)"
done
[[ -f .env ]] || { cp .env.example .env && echo "created .env from .env.example"; }
echo "Done. Next: make build && make up"