#!/usr/bin/env bash set -euxo pipefail if [ -f "${HOME}/.env_common" ]; then source "${HOME}/.env_common" else echo ".env_common not found" exit 1 fi TILDEGIT_URL="https://tildegit.org" TILDEGIT_CLONE_URL="git@tildegit.org:hyperreal" TILDEGIT_BACKUP_DIR="/naspool/tildegit-backup" KNOT_BACKUP_DIR="/naspool/knot-backup" KNOT_CLONE_URL="git@knot.moonshadow.dev:hyperreal.bsky.moonshadow.dev" curl -s -k \ -u "hyperreal:${GITEA_TOKEN}" \ "${TILDEGIT_URL}/api/v1/user/repos?limit=100&page=1" | jq '.[].name | select(.!="keyoxide_proof")' | tr -d '"' | tee "${TILDEGIT_BACKUP_DIR}/repos.txt" while read -r line; do if [ -d "${TILDEGIT_BACKUP_DIR}/${line}" ]; then cd "${TILDEGIT_BACKUP_DIR}/${line}" git pull else cd "${TILDEGIT_BACKUP_DIR}" git clone "${TILDEGIT_CLONE_URL}/${line}.git" fi sleep 30 done <"${TILDEGIT_BACKUP_DIR}/repos.txt" knot_repos=( "ansible-homelab" "bin" "dotfiles" "hyperreal.coffee" "justfiles" ) for repo in "${knot_repos[@]}"; do if [ -d "${KNOT_BACKUP_DIR}/${repo}" ]; then cd "${KNOT_BACKUP_DIR}/${repo}" git pull else cd "${KNOT_BACKUP_DIR}" git clone "${KNOT_CLONE_URL}/${repo}" fi sleep 30 done # vim: ts=4 sw=4 sts=4 ai et ft=bash