Assorted shell and Python scripts
1#!/usr/bin/env bash 2 3set -euxo pipefail 4 5if [ -f "${HOME}/.env_common" ]; then 6 source "${HOME}/.env_common" 7else 8 echo ".env_common not found" 9 exit 1 10fi 11 12TILDEGIT_URL="https://tildegit.org" 13TILDEGIT_CLONE_URL="git@tildegit.org:hyperreal" 14BACKUP_DIR="/naspool/tildegit-backup" 15 16curl -s -k \ 17 -u "hyperreal:${GITEA_TOKEN}" \ 18 "${TILDEGIT_URL}/api/v1/user/repos?limit=100&page=1" | 19 jq '.[].name | select(.!="keyoxide_proof")' | 20 tr -d '"' | 21 tee "${BACKUP_DIR}/repos.txt" 22 23while read -r line; do 24 if [ -d "${BACKUP_DIR}/${line}" ]; then 25 cd "${BACKUP_DIR}/${line}" 26 git pull 27 else 28 cd "${BACKUP_DIR}" 29 git clone "${TILDEGIT_CLONE_URL}/${line}.git" 30 fi 31 sleep 30 32done <"${BACKUP_DIR}/repos.txt" 33 34# vim: ts=4 sw=4 sts=4 ai et ft=bash