jhj
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled

This commit is contained in:
nose
2025-12-24 23:31:05 -08:00
parent a2ec5ba22b
commit 2542a68479
5 changed files with 117 additions and 2 deletions

View File

@@ -476,6 +476,58 @@ else
fi
fi
# Ensure mpv is available (used by some pipelines). Best-effort install if missing.
install_mpv_if_missing() {
if command -v mpv >/dev/null 2>&1; then
echo "mpv found: $(mpv --version 2>/dev/null | head -n 1 || echo 'mpv')"
return 0
fi
echo "mpv not found on PATH; attempting to install..." >&2
local prefix=""
if [[ $(id -u) -ne 0 ]]; then
if command -v sudo >/dev/null 2>&1; then
prefix="sudo"
else
echo "Warning: mpv is missing and sudo is not available; install mpv manually and ensure it's on PATH." >&2
return 0
fi
fi
# Try a few common package managers.
if command -v apt-get >/dev/null 2>&1; then
$prefix apt-get update -y >/dev/null 2>&1 || $prefix apt-get update || true
$prefix env DEBIAN_FRONTEND=noninteractive apt-get install -y mpv || true
elif command -v apt >/dev/null 2>&1; then
$prefix apt update -y >/dev/null 2>&1 || $prefix apt update || true
$prefix env DEBIAN_FRONTEND=noninteractive apt install -y mpv || true
elif command -v dnf >/dev/null 2>&1; then
$prefix dnf install -y mpv || true
elif command -v yum >/dev/null 2>&1; then
$prefix yum install -y mpv || true
elif command -v pacman >/dev/null 2>&1; then
$prefix pacman -S --noconfirm mpv || true
elif command -v zypper >/dev/null 2>&1; then
$prefix zypper --non-interactive install mpv || true
elif command -v apk >/dev/null 2>&1; then
$prefix apk add --no-interactive mpv || $prefix apk add mpv || true
elif command -v brew >/dev/null 2>&1; then
brew install mpv || true
else
echo "Warning: mpv is missing and no supported package manager was found. Install mpv manually and ensure it's on PATH." >&2
return 0
fi
if command -v mpv >/dev/null 2>&1; then
echo "mpv installed: $(mpv --version 2>/dev/null | head -n 1 || echo 'mpv')"
else
echo "Warning: attempted to install mpv but it is still not on PATH. Install mpv manually." >&2
fi
}
install_mpv_if_missing
if [[ "$DESKTOP" == "true" ]]; then
echo "Creating desktop launcher..."
EXEC_PATH="$VENV_PATH/bin/mm"