aboutsummaryrefslogtreecommitdiff
path: root/cgit-backup.sh
diff options
context:
space:
mode:
authorheqnx <root@heqnx.com>2025-05-27 22:09:08 +0300
committerheqnx <root@heqnx.com>2025-05-27 22:09:08 +0300
commita8c456075d6bd82b82bad23b3ed935c81b7a50d8 (patch)
tree11edc244ec52e38d2f19786b4ba2c2af2f948582 /cgit-backup.sh
parent97ae6428b95aeed473cebb0d007d2059ae1545d6 (diff)
downloadgists-a8c456075d6bd82b82bad23b3ed935c81b7a50d8.tar.gz
gists-a8c456075d6bd82b82bad23b3ed935c81b7a50d8.zip
moved script
Diffstat (limited to 'cgit-backup.sh')
-rw-r--r--cgit-backup.sh34
1 files changed, 0 insertions, 34 deletions
diff --git a/cgit-backup.sh b/cgit-backup.sh
deleted file mode 100644
index 276dce5..0000000
--- a/cgit-backup.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-
-cgit="https://cgit.heqnx.com"
-
-mkdir -p repos
-
-repos=$(curl -sSL "${cgit}" | grep -o "<a href='/[^']*/'>" | sed -E "s/^<a href='([^']*)'>/\1/" | sort -u)
-
-while IFS= read -r repo_path; do
- repo_name=$(basename "${repo_path}")
- repo_url="${cgit}${repo_path}"
- repo_dir="repos/${repo_name}"
-
- printf "%s\n" "[inf] processing ${repo_url}"
-
- if test -d "${repo_dir}"; then
- if test -d "${repo_dir}/.git.bak"; then
- printf "%s\n" "[inf] restoring .git from .git.bak for ${repo_name}"
- mv "${repo_dir}/.git.bak" "${repo_dir}/.git"
- fi
- printf "%s\n" "[inf] fetching updates for ${repo_name}"
- git -C "${repo_dir}" fetch origin
- git -C "${repo_dir}" reset --hard origin/HEAD
- else
- printf "%s\n" "[inf] cloning ${repo_name}"
- git -C repos clone "${repo_url}"
- fi
-
- if test -d "${repo_dir}/.git"; then
- printf "%s\n" "[inf] moving .git to .git.bak for ${repo_name}"
- mv "${repo_dir}/.git" "${repo_dir}/.git.bak"
- fi
-
-done <<< "${repos}"