summaryrefslogtreecommitdiff
path: root/dotfiles/common/.local/bin/update-backup-repositories
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-01-26 17:36:38 -0600
committerCraig Jennings <c@cjennings.net>2026-01-26 17:36:38 -0600
commitdada2f255daaa2fb493ec8c7d47e2a8123aea494 (patch)
tree0c0eeb84bb7b6e66a2d7f41cdfd061b25f80cc14 /dotfiles/common/.local/bin/update-backup-repositories
parentd50e5955837788fc69b4d5bc74cb574b859ed31a (diff)
refactor(dotfiles): rename system/ to common/ and remove unused configs
Rename dotfiles/system to dotfiles/common for clarity - indicates shared dotfiles used across all desktop environments (DWM, Hyprland). Removed config directories for uninstalled applications: - ghostty (using different terminal) - lf (using ranger instead) - mopidy (using mpd instead) - nitrogen (X11-only, obsolete for Wayland) - pychess (not installed) - JetBrains (not installed via archsetup) - youtube-dl (using yt-dlp with different config location) Kept audacious config for potential future use. Updated all references in archsetup, CLAUDE.md, todo.org, and validation.sh. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'dotfiles/common/.local/bin/update-backup-repositories')
-rwxr-xr-xdotfiles/common/.local/bin/update-backup-repositories56
1 files changed, 56 insertions, 0 deletions
diff --git a/dotfiles/common/.local/bin/update-backup-repositories b/dotfiles/common/.local/bin/update-backup-repositories
new file mode 100755
index 0000000..a91b438
--- /dev/null
+++ b/dotfiles/common/.local/bin/update-backup-repositories
@@ -0,0 +1,56 @@
+#!/bin/sh
+# Craig Jennings <c@cjennings.net>
+# updates or clones repositories for backup
+
+REPOS_HOME="/media/backup/repositories/"
+
+# Create REPOS_HOME dir if not exists
+if [ ! -d "$REPOS_HOME" ]; then
+ mkdir -p "$REPOS_HOME"
+fi
+
+# Make sure REPOS_HOME dir is writable
+if [ ! -w "$REPOS_HOME" ]; then
+ echo "Directory $REPOS_HOME is not writable."
+ exit 1
+fi
+
+# Make sure git is available
+if ! command -v git >/dev/null 2>&1; then
+ echo "Git command does not exist. Please install git."
+ exit 1
+fi
+
+cd "$REPOS_HOME"
+
+repos="
+git@cjennings.net:archsetup.git
+git@cjennings.net:dmenu.git
+git@cjennings.net:dotemacs.git
+git@cjennings.net:dotfiles.git
+git@cjennings.net:dwm.git
+git@cjennings.net:pinentry-dmenu.git
+git@cjennings.net:rsyncshot.git
+git@cjennings.net:st.git
+git@github.com:cjennings/emacs-wttrin.git
+https://github.com/d12frosted/elpa-mirror.git
+https://github.com/mirrors/emacs.git
+"
+
+for repo in $repos; do
+ dir=$(echo "$repo" | awk -F'[/:]' '{gsub(/.git/, "", $NF); print $NF}')
+ # Note on the above awk command:
+ # awk -F'[/:]': uses awk with a regex field delimiter that matches both : and /
+ # which will work with both ssh and http style URLs.
+ # '{gsub(/.git/, "", $NF); print $NF}: This removes the ".git" postfixes from the last field ($NF)
+ # which leaves only the repo name.
+
+ fullpath="$REPOS_HOME$dir"
+ if [ -d "$fullpath" ]; then
+ echo "Repository $dir exists at $fullpath, pulling..."
+ (cd "$fullpath" && git pull)
+ else
+ echo "Repository $dir doesn't exist at $fullpath, cloning..."
+ cd "$REPOS_HOME" && git clone --depth 1 "$repo" "$fullpath"
+ fi
+done