aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-07-11 11:03:43 +0200
committerDanilo M. <danix@danix.xyz>2026-07-11 11:03:43 +0200
commit2a0866581c6c909061baca3d3252a2137719defb (patch)
tree0812cf3239b3fe429901cbb8f7ae5e1d3a1f32db
parenta7c03410075c375dd765381c56a7a783abe3c43b (diff)
downloadsbo-batch-tester-2a0866581c6c909061baca3d3252a2137719defb.tar.gz
sbo-batch-tester-2a0866581c6c909061baca3d3252a2137719defb.zip
Add setup_repo (rm+rsync+clone+shadow, exit mode)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
-rwxr-xr-xsbo-batch-test30
1 files changed, 30 insertions, 0 deletions
diff --git a/sbo-batch-test b/sbo-batch-test
index 9a4b2a9..b33bb65 100755
--- a/sbo-batch-test
+++ b/sbo-batch-test
@@ -398,6 +398,36 @@ shadow_scan() {
done
}
+# --setup-repo: first-time full build of the SBo tree. rm -rf the tree root,
+# rsync it fresh, clone the personal subtrees in, shadow upstream dups. Runs its
+# own checks (the tree may not exist yet). Standalone: exits, never builds.
+setup_repo() {
+ [[ $EUID -eq 0 ]] || { echo "--setup-repo must run as root (rsync/rm to the tree)." >&2; exit 1; }
+ require_config
+ [[ -n "$SBO_RSYNC_URL" ]] || { echo "SBO_RSYNC_URL is unset; set it in $SBO_BATCH_CONFIG." >&2; exit 1; }
+ local root="${SBO_TREE_ROOTS[0]}"
+ [[ -n "$root" ]] || { echo "SBO_TREE_ROOTS[0] is empty." >&2; exit 1; }
+
+ echo "This will REMOVE $root and rsync it fresh from $SBO_RSYNC_URL."
+ read -rp "Proceed? [y/N] " confirm
+ [[ "$confirm" =~ ^[Yy]$ ]] || { echo "Aborted."; exit 0; }
+
+ rm -rf "${root:?}"
+ echo "Rsyncing tree..."
+ rsync_tree "$root" || { echo "rsync failed." >&2; exit 1; }
+
+ local dir
+ for dir in "${!SBO_PERSONAL_TREES[@]}"; do
+ echo "Cloning $dir..."
+ git clone "${SBO_PERSONAL_TREES[$dir]}" "$root/$dir" \
+ || { echo "clone of $dir failed." >&2; exit 1; }
+ done
+
+ shadow_scan "$root"
+ echo "Repository ready at $root"
+ exit 0
+}
+
# =============================================================================
# Package cache. Persistent, on-disk store of built packages so unchanged deps
# are installed from cache instead of rebuilt. Layout mirrors the SBo tree: