X-Git-Url: https://vilimpoc.org/repos/dotfiles/blobdiff_plain/03b846cd7abe33973416d13f981462969bce4507..5c01c42c07a9003596daec75d22f779e743f8e55:/setup-linux.sh 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..."