From 30c6bc22a445105e7e7f37fb00ca054de1ecf3ad Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 19 Oct 2026 19:11:13 +0200 Subject: sbshadow: add --yes/--no, sbpull: pass flag, return sbshadow status sbshadow --yes applies the plan without asking, --no shows it and leaves the tree unchanged, so non-interactive callers (sb-builder runs it as a detached job with no stdin) never hit the prompt. No flag keeps the interactive prompt. SBO_REPO overrides the repo path for testing. sbpull passes the flag on, and now returns sbshadow's exit status instead of popd's, which made a failed sbshadow look successful. Co-Authored-By: Claude Opus 5.5 --- sbpull.bash | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sbpull.bash') diff --git a/sbpull.bash b/sbpull.bash index cd48864..a390e38 100644 --- a/sbpull.bash +++ b/sbpull.bash @@ -1,4 +1,5 @@ # sbpull: pull one overlay subtree into SBo-danix, then reconcile shadowing. +# Usage: sbpull {personal|pentesting} [--yes|--no], the flag goes to sbshadow. # Source from root's ~/.bashrc: . /path/to/sbpull.bash # # Copyright (C) 2026 Danilo M. @@ -9,7 +10,7 @@ sbpull() { local repo_dir="/var/lib/sbopkg/SBo-danix" - local target="$1" + local target="$1" flag="${2:-}" local prefix branch remote case "$target" in @@ -22,7 +23,7 @@ sbpull() { remote="my-pentesting" ;; *) - echo "sbpull: usage: sbpull {personal|pentesting}" >&2 + echo "sbpull: usage: sbpull {personal|pentesting} [--yes|--no]" >&2 return 1 ;; esac @@ -33,12 +34,13 @@ sbpull() { if git subtree pull --prefix="$prefix" "$remote" "$branch" --squash; then echo "sbpull: $target subtree updated." - sbshadow + sbshadow ${flag:+"$flag"} + local rc=$? + popd > /dev/null + return "$rc" else echo "sbpull: git subtree pull failed for $target, check output above." >&2 popd > /dev/null return 1 fi - - popd > /dev/null } -- cgit v1.2.3