summaryrefslogtreecommitdiff
path: root/bin/dotfiles-sync
diff options
context:
space:
mode:
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