summaryrefslogtreecommitdiff
path: root/bin/dotfiles-sync
diff options
context:
space:
mode:
authorIgor Soarez <igor@soarez.org>2026-09-17 19:45:23 +0100
committerIgor Soarez <igor@soarez.org>2026-09-17 19:45:23 +0100
commit13cc065ec014b86369dfe4ad60d1a43fa06fd251 (patch)
tree684690c61b7b59758c2aac132c65b81c86de0608 /bin/dotfiles-sync
dotfiles
Shell, editor and terminal configuration, the tools that go with them, and szecret, an age-based secret manager whose store lives elsewhere. History restarts here. What came before was not written to be read by anyone else, and carried machine names, addresses and an encrypted secret store; it is kept privately instead. What is left is meant to be safe on any machine, including one whose owner is not me: see CLAUDE.md for the rule it is written to.
Diffstat (limited to 'bin/dotfiles-sync')
-rwxr-xr-xbin/dotfiles-sync34
1 files changed, 34 insertions, 0 deletions
diff --git a/bin/dotfiles-sync b/bin/dotfiles-sync
new file mode 100755
index 0000000..503a1ed
--- /dev/null
+++ b/bin/dotfiles-sync
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Transitional, added 2026-09-17: the sync job moved to cloud-setup, whose
+# svc/setup.sh points each host's unit at its own copy. A host whose unit still
+# runs this path -- one that was offline when the units were regenerated --
+# lands here: bring its cloud-setup clone up to date and hand over, so it keeps
+# receiving until someone runs `dotfiles-sync-enable` there. Remove once no unit
+# points at this file.
+
+set -euo pipefail
+
+cloud_setup="$HOME/src/soarez/cloud-setup"
+target="$cloud_setup/bin/dotfiles-sync"
+
+if [[ ! -x "$target" && -d "$cloud_setup/.git" ]]
+then
+ umask 022
+ git -C "$cloud_setup" fetch --prune origin && git -C "$cloud_setup" merge --ff-only --quiet origin/master || true
+fi
+
+if [[ -x "$target" ]]
+then
+ exec "$target" "$@"
+fi
+
+>&2 cat <<MSG
+dotfiles-sync has moved to cloud-setup, and this host has no usable copy at
+$target. To recover:
+
+ git -C $cloud_setup pull --ff-only
+ $(cd "$(dirname "$(readlink -f "$0")")/.." && pwd)/link.sh yes
+ dotfiles-sync-enable
+MSG
+exit 1