From: Max Vilimpoc Date: Mon, 31 Aug 2026 15:25:11 +0000 (+0200) Subject: dotfiles: install the common tools every project on these machines expects X-Git-Url: https://vilimpoc.org/repos/dotfiles/commitdiff_plain/a3a0d58cbdb1c79baa1454885179fefef1a2670a?ds=inline dotfiles: install the common tools every project on these machines expects ffmpeg, adb and python3-venv join shellcheck in the optional set. They are common across the projects here rather than specific to any one of them, so installing them once from this script means a per-project setup script only has to CHECK for them instead of carrying its own package-manager logic and its own sudo. That is exactly what RAWcorder's setup-linux-tests.sh now does. python3-venv is the one that is easy to miss. Debian and Ubuntu split venv and ensurepip out of python3, so `python3 -m venv` fails on a stock Ubuntu with an error telling you to apt-get it; Arch bundles both into python, so there is nothing to add there. Both names go through pick_pkg, like everything else here. ffprobe is checked but not installed: it has no package of its own and ships inside ffmpeg, so checking it separately also catches a stripped-down distro build that leaves it out. What stays out of this script, and the comment now says so: anything project-shaped. No virtualenvs, no per-repo Python packages, no test tooling. Those belong beside the repo that needs them. Also fixes a latent SC2318 in install_agi_deb. It read local ver="$1" tmp="$2" deb="$tmp/agi.deb" depends and the words of a `local` are expanded before `local` runs, so $tmp there is the OUTER scope's tmp, not the parameter being assigned beside it. The caller passes AGI_TMP and no outer tmp exists, so deb resolved to "/agi.deb" -- the download would have landed in the filesystem root, which the sudo re-exec would have permitted. Never observed, because AGI has not been installed from the .deb path on this machine. The script passes shellcheck on itself again. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01GXBBHFrwVKRsAMhtS7EkCR --- diff --git a/setup-linux.sh b/setup-linux.sh index 823dfa0..43426a2 100755 --- a/setup-linux.sh +++ b/setup-linux.sh @@ -208,7 +208,31 @@ if [ "$WANT_RSYNC" -eq 1 ]; then # Development tooling: not needed to build rsync, but useful when working # on its shell scripts -- including this one, which shellcheck keeps honest. - OPTIONAL+=(shellcheck) + # + # ffmpeg and adb are here for the same reason: they are common across the + # projects on these machines rather than specific to any one of them, so + # installing them once here means a per-project setup script only has to + # CHECK for them instead of carrying its own package-manager logic. What + # stays out of this script on purpose is anything project-shaped -- no + # virtualenvs, no per-repo Python packages, no test tooling. Those belong + # next to the repo that needs them (e.g. RAWcorder's setup-linux-tests.sh). + # + # ffmpeg ffmpeg + ffprobe, for building and probing test media + # adb reaches Android devices. AGI installs it too, but only + # on an --agi run, and it is worth having either way. + # python3-venv Debian and Ubuntu split venv and ensurepip out of python3, + # so `python3 -m venv` fails on a stock Ubuntu without it. + # Arch bundles both into `python`, so there is nothing to add. + OPTIONAL+=(shellcheck ffmpeg) + case "$PM" in + apt) + COMMON_PKG=$(pick_pkg python3-venv) && OPTIONAL+=("$COMMON_PKG") + COMMON_PKG=$(pick_pkg adb android-sdk-platform-tools) && OPTIONAL+=("$COMMON_PKG") + ;; + pacman) + COMMON_PKG=$(pick_pkg android-tools) && OPTIONAL+=("$COMMON_PKG") + ;; + esac # The manpages need one of two python3 markdown libraries; upstream prefers # cmarkgfm. Pick whichever this release actually offers. @@ -470,7 +494,10 @@ rewrite_deb_depends() { } install_agi_deb() { - local ver="$1" tmp="$2" deb="$tmp/agi.deb" depends + # Split across two 'local's: a value assigned in the same 'local' as the + # variable that uses it has not taken effect yet (SC2318). + local ver="$1" tmp="$2" + local deb="$tmp/agi.deb" depends agi_download "$AGI_BASE_URL/v$ver/agi-$ver-linux.deb" "$deb" || return 1 @@ -575,12 +602,17 @@ if [ "$WANT_RSYNC" -eq 1 ]; then check_cmd "$c" done - # Not required to build, so report it without failing the run. - if command -v shellcheck >/dev/null 2>&1; then - printf ' %-16s %s\n' "shellcheck" "$(command -v shellcheck)" - else - printf ' %-16s %s\n' "shellcheck" "not installed (optional)" - fi + # None of these is required to build rsync, so report them without failing + # the run. ffprobe has no package of its own -- it ships inside ffmpeg -- + # so it is checked rather than installed, which also catches a stripped-down + # distro build that leaves it out. + for c in shellcheck ffmpeg ffprobe adb; do + if command -v "$c" >/dev/null 2>&1; then + printf ' %-16s %s\n' "$c" "$(command -v "$c")" + else + printf ' %-16s %s\n' "$c" "not installed (optional)" + fi + done echo bold "Verifying optional libraries..."