aboutsummaryrefslogtreecommitdiffstats
path: root/sbshadow
diff options
context:
space:
mode:
Diffstat (limited to 'sbshadow')
-rwxr-xr-xsbshadow22
1 files changed, 20 insertions, 2 deletions
diff --git a/sbshadow b/sbshadow
index b928df1..25cf923 100755
--- a/sbshadow
+++ b/sbshadow
@@ -13,10 +13,24 @@
# phantom-dep hintfiles with mkhint -F.
#
# Called by slackrepo_setup_SBo-danix.sh and by sbpull after a subtree pull.
+#
+# Usage: sbshadow [--yes|--no]
+# no flag show the plan and ask before changing anything
+# --yes apply the plan without asking
+# --no show the plan only, tree unchanged (preview)
+# SBO_REPO overrides the repo path (used to test against a throwaway repo).
set -euo pipefail
-REPO="/var/lib/sbopkg/SBo-danix"
+answer=""
+case "${1:-}" in
+ --yes) answer=y ;;
+ --no) answer=n ;;
+ "") ;;
+ *) echo "usage: sbshadow [--yes|--no]" >&2; exit 2 ;;
+esac
+
+REPO="${SBO_REPO:-/var/lib/sbopkg/SBo-danix}"
UPSTREAM="current"
cd "$REPO"
@@ -47,7 +61,11 @@ else
(( ${#to_restore[@]} )) && printf 'unshadow: %s\n' "${to_restore[@]}"
echo
- read -rp "Proceed? [y/N] " confirm
+ if [[ -n $answer ]]; then
+ confirm=$answer
+ else
+ read -rp "Proceed? [y/N] " confirm
+ fi
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
echo "sbshadow: aborted, tree unchanged."
else