lesavka: verify client runtime prerequisites

This commit is contained in:
Brad Stein 2026-04-16 14:22:20 -03:00
parent 7e582507a0
commit 16ce4cabec

View File

@ -12,6 +12,16 @@ log() {
printf '==> %s\n' "$*"
}
require_command() {
local cmd=$1
local pkg_hint=$2
if command -v "$cmd" >/dev/null 2>&1; then
return 0
fi
echo "❌ required command '$cmd' is unavailable after install (expected via $pkg_hint)" >&2
exit 1
}
mkdir -p "$TMPDIR"
log "1. Installing base packages"
@ -19,7 +29,7 @@ log "1. Installing base packages"
# tightly versioned PipeWire packages, and Lesavka should not force an audio
# stack upgrade just to install the client.
sudo pacman -Sq --needed --noconfirm \
git rustup protobuf gcc clang evtest base-devel \
git rustup protobuf gcc clang evtest base-devel libpulse \
gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav \
wmctrl qt6-tools wl-clipboard xclip xsel desktop-file-utils
@ -50,6 +60,21 @@ fi
log "1c. Ensuring input group access for $ORIG_USER"
sudo usermod -aG input "$ORIG_USER"
log "1d. Verifying runtime tools"
require_command pactl "libpulse"
require_command wmctrl "wmctrl"
require_command qdbus6 "qt6-tools"
if ! command -v wl-paste >/dev/null 2>&1 \
&& ! command -v xclip >/dev/null 2>&1 \
&& ! command -v xsel >/dev/null 2>&1; then
echo "❌ no clipboard reader found after install (expected one of wl-clipboard/xclip/xsel)" >&2
exit 1
fi
if ! sudo -u "$ORIG_USER" pactl info >/dev/null 2>&1; then
echo "⚠️ pactl is installed, but no PulseAudio/PipeWire Pulse server is reachable right now."
echo " Lesavka will still install, but local speaker/mic staging may stay empty until the host audio session is up."
fi
# 2. Rust tool-chain for both root & user
log "2. Ensuring Rust toolchain"
sudo rustup default stable