aboutsummaryrefslogtreecommitdiffstats
path: root/.extras/hooks
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-06-26 09:43:10 +0200
committerDanilo M. <danix@danix.xyz>2026-06-26 09:43:10 +0200
commit07ca5beb3738aa09cba308787a3250602f417b42 (patch)
tree955bfafd03f95a92c8496004ff52398aa95acb58 /.extras/hooks
parentcea6b1faa8dbc475a77cc3708628e96d72004fdb (diff)
downloadmy-slackbuilds-07ca5beb3738aa09cba308787a3250602f417b42.tar.gz
my-slackbuilds-07ca5beb3738aa09cba308787a3250602f417b42.zip
hooks: add SBO_ARCHIVE override to post-commit prompt
Allow non-interactive callers (agents, scripts) to answer the SBo archive prompt via SBO_ARCHIVE=yes|no instead of needing /dev/tty. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to '.extras/hooks')
-rwxr-xr-x.extras/hooks/post-commit25
1 files changed, 17 insertions, 8 deletions
diff --git a/.extras/hooks/post-commit b/.extras/hooks/post-commit
index 6350615..6ed63f7 100755
--- a/.extras/hooks/post-commit
+++ b/.extras/hooks/post-commit
@@ -31,14 +31,23 @@ for pkg in "${PACKAGES[@]}"; do
printf '%s\n' "${f#"$REPO_ROOT/"}"
done < <(find "$REPO_ROOT/$pkg" -type f | sort)
echo ""
- # Need an interactive terminal to prompt; skip cleanly if none.
- if [ ! -r /dev/tty ]; then
- echo " -> No terminal, skipped (run hook interactively to archive)."
- continue
- fi
- printf "Create SBo archive for '%s'? [y/N] " "$pkg"
- answer=""
- read -r answer </dev/tty || answer=""
+ # Non-interactive override: set SBO_ARCHIVE=yes|no to skip the prompt.
+ # Lets agents and scripts answer without a terminal.
+ case "${SBO_ARCHIVE:-}" in
+ [yY]|[yY][eE][sS]) answer=yes ;;
+ [nN]|[nN][oO]) echo " -> Skipped (SBO_ARCHIVE=no)."; continue ;;
+ "")
+ # No override: need an interactive terminal to prompt.
+ if [ ! -r /dev/tty ]; then
+ echo " -> No terminal, skipped (set SBO_ARCHIVE=yes to archive)."
+ continue
+ fi
+ printf "Create SBo archive for '%s'? [y/N] " "$pkg"
+ answer=""
+ read -r answer </dev/tty || answer=""
+ ;;
+ *) echo " -> Skipped (SBO_ARCHIVE='$SBO_ARCHIVE' unrecognized)."; continue ;;
+ esac
case "$answer" in
[yY]|[yY][eE][sS])
mkdir -p "$SBO_DIR"