Assorted shell and Python scripts

Add tildegit_backup

Changed files
+32
+32
tildegit_backup
···
+
#!/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"
+
BACKUP_DIR="/naspool/tildegit-backup"
+
+
curl -s -k \
+
-u "hyperreal:${GITEA_TOKEN}" \
+
"${TILDEGIT_URL}/api/v1/user/repos?limit=100&page=1" |
+
jq '.[].name' |
+
tr -d '"' |
+
tee "${BACKUP_DIR}/repos.txt"
+
+
while read -r line; do
+
if [ -d "${BACKUP_DIR}/${line}" ]; then
+
cd "${BACKUP_DIR}/${line}"
+
git pull
+
else
+
cd "${BACKUP_DIR}"
+
git clone "${TILDEGIT_URL}/hyperreal/${line}.git"
+
fi
+
done <"${BACKUP_DIR}/repos.txt"
+
+
# vim: ts=4 sw=4 sts=4 ai et ft=bash