diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-19 19:11:13 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-19 19:11:13 +0200 |
| commit | 30c6bc22a445105e7e7f37fb00ca054de1ecf3ad (patch) | |
| tree | 025a4df9a930434f528985d379afb1762fca10ec /sbpull.bash | |
| parent | 0679099f804000123f2999ce07948d324305d998 (diff) | |
| download | slackrepo_setup-30c6bc22a445105e7e7f37fb00ca054de1ecf3ad.tar.gz slackrepo_setup-30c6bc22a445105e7e7f37fb00ca054de1ecf3ad.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'sbpull.bash')
| -rw-r--r-- | sbpull.bash | 12 |
1 files changed, 7 insertions, 5 deletions
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. <danix@danix.xyz> @@ -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 } |
