Assorted shell and Python scripts

->blog2gemlog, -tildegit_backup

-34
-34
tildegit_backup
··· 1 - #!/usr/bin/env bash 2 - 3 - set -euxo pipefail 4 - 5 - if [ -f "${HOME}/.env_common" ]; then 6 - source "${HOME}/.env_common" 7 - else 8 - echo ".env_common not found" 9 - exit 1 10 - fi 11 - 12 - TILDEGIT_URL="https://tildegit.org" 13 - TILDEGIT_CLONE_URL="git@tildegit.org:hyperreal" 14 - BACKUP_DIR="/naspool/tildegit-backup" 15 - 16 - curl -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 - 23 - while 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 32 - done <"${BACKUP_DIR}/repos.txt" 33 - 34 - # vim: ts=4 sw=4 sts=4 ai et ft=bash