fix(install): reliable stop, VERSION flag, and on-device walkthrough

- aftertouch init script: stop) now waits up to 15 s for SIGTERM
  to take effect, then escalates to SIGKILL; prevents stale daemon
  processes after '/etc/init.d/aftertouch stop' returns (weissigera's
  workaround was manual 'killall aftertouch-service')

- install.sh: add --version / -v CLI flag so the version to install
  can be passed as a command-line argument in addition to the VERSION
  env var; document the trade-off of the hard-coded default in a
  comment; update scripts/on-device-install/README.md with concrete
  usage examples for env-override, CLI flag, and rollback tip

- docs/guides/ON-DEVICE-INSTALL-WALKTHROUGH.md: 10-step runbook
  derived from weissigera's field-tested procedure (issue #329
  comment #4521280831): SSH connection, storage cleanup, install via
  install.sh, reboot, SSH tunnel, Health QuickFix, pairing
  verification, soundtouch-cli download, custom-radio preset setup,
  and final verification; troubleshooting table at the end

Closes #329 (remaining two tasks)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tobias Gesellchen
2026-05-24 11:31:16 +02:00
co-authored by Claude Sonnet 4.6
parent 124414943c
commit 73d0d4b176
4 changed files with 362 additions and 1 deletions
+28 -1
View File
@@ -2,6 +2,9 @@
Allows to run AfterTouch on SoundTouch devices directly, eliminating the need to run and maintain a separate server on the local network.
For a complete step-by-step walkthrough — from first SSH connection through verified radio preset playback — see
[docs/guides/ON-DEVICE-INSTALL-WALKTHROUGH.md](../../docs/guides/ON-DEVICE-INSTALL-WALKTHROUGH.md).
## Disclaimer
### Invasiveness
@@ -82,7 +85,31 @@ The init script's `status` now distinguishes "running with listener up" from "PI
## Updating AfterTouch
To update AfterTouch, simply run the installation command again. The installer will check if there's a new version available and update it if necessary.
Run the installer again with the version you want to install. The script backs up the currently-running binary (named after its version), installs the new one, and prunes older leftover artefacts to keep `/mnt/nv` free.
**Install (or upgrade to) a specific version** — three equivalent ways:
```bash
# 1. Environment variable (works when piping into sh)
VERSION=0.92.0 rw && curl -sSL https://raw.githubusercontent.com/gesellix/Bose-SoundTouch/main/scripts/on-device-install/install.sh | sh
# 2. Command-line flag (pass args after `sh -s --`)
rw && curl -sSL https://raw.githubusercontent.com/gesellix/Bose-SoundTouch/main/scripts/on-device-install/install.sh | sh -s -- --version 0.92.0
# 3. Download first, then run with a flag
curl -sSLo install.sh https://raw.githubusercontent.com/gesellix/Bose-SoundTouch/main/scripts/on-device-install/install.sh
sh install.sh --version 0.92.0
```
Running **without** a version override installs the version hard-coded in the script (the latest release at the time the script was published). That default is updated with each release; if you're running from `main`, it reflects the most recent tagged version.
> **Tip — rollback:** if the new binary misbehaves, the installer left a `.backup` file alongside it:
> ```bash
> ls /mnt/nv/aftertouch/aftertouch-service*.backup
> cp /mnt/nv/aftertouch/aftertouch-service.<old-version>.backup \
> /mnt/nv/aftertouch/aftertouch-service
> /etc/init.d/aftertouch restart
> ```
## Uninstallation
+14
View File
@@ -81,10 +81,24 @@ case "$1" in
stop)
echo "Stopping $DESC..."
if [ -f "$PIDFILE" ]; then
PID=$(cat "$PIDFILE")
start-stop-daemon --stop \
--quiet \
--oknodo \
--pidfile "$PIDFILE"
# Wait up to 15 s for SIGTERM to take effect before escalating.
# The Go HTTP server exits promptly on SIGTERM in normal conditions;
# the loop handles the rare case where it is stuck in a blocking syscall.
tries=0
while [ $tries -lt 15 ] && kill -0 "$PID" 2>/dev/null; do
sleep 1
tries=$((tries + 1))
done
if kill -0 "$PID" 2>/dev/null; then
echo "Warning: $NAME (PID $PID) still alive after ${tries}s; sending SIGKILL..." >&2
kill -9 "$PID" 2>/dev/null || true
sleep 1
fi
rm -f "$PIDFILE"
else
echo "No $NAME running (no PID file)." >&2
+24
View File
@@ -1,7 +1,31 @@
#!/bin/bash
set -eo pipefail
# Default version installed when no override is provided. Update this value
# each time a new release is cut so that running the canonical one-liner
# curl -sSL .../install.sh | sh
# picks up the latest binary without extra arguments.
#
# Override via environment variable or the --version/-v flag:
# VERSION=0.92.0 curl -sSL .../install.sh | sh
# curl -sSL .../install.sh | sh -s -- --version 0.92.0
VERSION=${VERSION:-0.91.0}
# Parse optional command-line arguments so the script can be invoked as:
# install.sh --version 0.92.0
# install.sh -v 0.92.0
while [ $# -gt 0 ]; do
case "$1" in
--version|-v)
if [ -z "$2" ]; then
echo "ERROR: --version requires an argument." >&2; exit 1
fi
VERSION="$2"; shift 2;;
--) shift; break;;
*) echo "Unknown argument: $1" >&2; exit 1;;
esac
done
GH_REPO=${GH_REPO:-gesellix/Bose-SoundTouch}
BINARY_URL=${BINARY_URL:-https://github.com/$GH_REPO/releases/download/v$VERSION/soundtouch-service-v$VERSION-linux-armv7}
INIT_SCRIPT_URL=${INIT_SCRIPT_URL:-https://raw.githubusercontent.com/$GH_REPO/v$VERSION/scripts/on-device-install/aftertouch}