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"
13BACKUP_DIR="/naspool/tildegit-backup"
14
15curl -s -k \
16 -u "hyperreal:${GITEA_TOKEN}" \
17 "${TILDEGIT_URL}/api/v1/user/repos?limit=100&page=1" |
18 jq '.[].name | select(.!="keyoxide_proof")' |
19 tr -d '"' |
20 tee "${BACKUP_DIR}/repos.txt"
21
22while read -r line; do
23 if [ -d "${BACKUP_DIR}/${line}" ]; then
24 cd "${BACKUP_DIR}/${line}"
25 git pull
26 else
27 cd "${BACKUP_DIR}"
28 git clone "${TILDEGIT_URL}/hyperreal/${line}.git"
29 fi
30done <"${BACKUP_DIR}/repos.txt"
31
32# vim: ts=4 sw=4 sts=4 ai et ft=bash