tangled
alpha
login
or
join now
hyperreal.bsky.moonshadow.dev
/
bin
0
fork
atom
Assorted shell and Python scripts
0
fork
atom
overview
issues
pulls
pipelines
->blog2gemlog, -tildegit_backup
hyperreal.bsky.moonshadow.dev
3 months ago
1676fc69
0a710bbc
-34
1 changed file
expand all
collapse all
unified
split
tildegit_backup
-34
tildegit_backup
···
1
1
-
#!/usr/bin/env bash
2
2
-
3
3
-
set -euxo pipefail
4
4
-
5
5
-
if [ -f "${HOME}/.env_common" ]; then
6
6
-
source "${HOME}/.env_common"
7
7
-
else
8
8
-
echo ".env_common not found"
9
9
-
exit 1
10
10
-
fi
11
11
-
12
12
-
TILDEGIT_URL="https://tildegit.org"
13
13
-
TILDEGIT_CLONE_URL="git@tildegit.org:hyperreal"
14
14
-
BACKUP_DIR="/naspool/tildegit-backup"
15
15
-
16
16
-
curl -s -k \
17
17
-
-u "hyperreal:${GITEA_TOKEN}" \
18
18
-
"${TILDEGIT_URL}/api/v1/user/repos?limit=100&page=1" |
19
19
-
jq '.[].name | select(.!="keyoxide_proof")' |
20
20
-
tr -d '"' |
21
21
-
tee "${BACKUP_DIR}/repos.txt"
22
22
-
23
23
-
while read -r line; do
24
24
-
if [ -d "${BACKUP_DIR}/${line}" ]; then
25
25
-
cd "${BACKUP_DIR}/${line}"
26
26
-
git pull
27
27
-
else
28
28
-
cd "${BACKUP_DIR}"
29
29
-
git clone "${TILDEGIT_CLONE_URL}/${line}.git"
30
30
-
fi
31
31
-
sleep 30
32
32
-
done <"${BACKUP_DIR}/repos.txt"
33
33
-
34
34
-
# vim: ts=4 sw=4 sts=4 ai et ft=bash