Optimize installer: preflight checks, tuned conf, doctor, faster default
Layers a few things on top of the initial scaffold: - Default to sunshine-bin (precompiled, ~seconds) instead of building from source. --from-source restores the old behavior. - Add lib/preflight.sh: catches the gotchas before any work is done — Wayland session, NVIDIA driver responsive, nvidia-drm.modeset, amdgpu loaded, pipewire-pulse present, SSH-without-session warning. - Add lib/config.sh: writes a tuned ~/.config/sunshine/sunshine.conf with per-vendor encoder settings (NVENC P1+ll+cbr, VAAPI ultralowlatency, QuickSync veryfast), KMS capture, pulse audio sink. Uses a "# managed-by: omarchy-moonlight" marker; removing it hands ownership back to the user and the installer won't touch the file again. - Add lib/verify.sh: post-install verification of every step (cap_sys_admin set, group resolves, udev rule present, /dev/uinput exists, encoder reachable, service active, :47990 listening). Same checks are reachable standalone via --doctor. - Install runtime helpers (pipewire-pulse, vulkan-tools, libva-utils) alongside Sunshine for diagnostics + audio. - Uninstall handles both sunshine + sunshine-bin and the -bin moonlight variant. - README documents the tuning table, the new flags, and the modeset troubleshooting path.
This commit is contained in:
37
install.sh
37
install.sh
@@ -10,14 +10,20 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/lib/common.sh"
|
||||
# shellcheck source=lib/detect.sh
|
||||
source "$SCRIPT_DIR/lib/detect.sh"
|
||||
# shellcheck source=lib/preflight.sh
|
||||
source "$SCRIPT_DIR/lib/preflight.sh"
|
||||
# shellcheck source=lib/packages.sh
|
||||
source "$SCRIPT_DIR/lib/packages.sh"
|
||||
# shellcheck source=lib/permissions.sh
|
||||
source "$SCRIPT_DIR/lib/permissions.sh"
|
||||
# shellcheck source=lib/config.sh
|
||||
source "$SCRIPT_DIR/lib/config.sh"
|
||||
# shellcheck source=lib/firewall.sh
|
||||
source "$SCRIPT_DIR/lib/firewall.sh"
|
||||
# shellcheck source=lib/service.sh
|
||||
source "$SCRIPT_DIR/lib/service.sh"
|
||||
# shellcheck source=lib/verify.sh
|
||||
source "$SCRIPT_DIR/lib/verify.sh"
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
@@ -30,11 +36,14 @@ Options:
|
||||
--no-firewall Skip firewall configuration
|
||||
--no-moonlight Don't install moonlight-qt (host-only setup)
|
||||
--no-sunshine Don't install sunshine (client-only setup)
|
||||
--no-config Don't write a tuned sunshine.conf
|
||||
--from-source Build Sunshine from source (equivalent to SUNSHINE_PKG=sunshine)
|
||||
--doctor Run only the post-install verification checks
|
||||
-h, --help Show this help
|
||||
|
||||
Environment overrides:
|
||||
SUNSHINE_PKG AUR package to use for Sunshine (default: sunshine)
|
||||
Set to 'sunshine-bin' for the precompiled build.
|
||||
SUNSHINE_PKG AUR package to use for Sunshine (default: sunshine-bin)
|
||||
Set to 'sunshine' to build from source instead.
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -42,6 +51,8 @@ AUTOSTART=1
|
||||
FIREWALL=1
|
||||
INSTALL_SUNSHINE=1
|
||||
INSTALL_MOONLIGHT=1
|
||||
WRITE_CONFIG=1
|
||||
DOCTOR_ONLY=0
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
@@ -49,6 +60,9 @@ while [[ $# -gt 0 ]]; do
|
||||
--no-firewall) FIREWALL=0 ;;
|
||||
--no-moonlight) INSTALL_MOONLIGHT=0 ;;
|
||||
--no-sunshine) INSTALL_SUNSHINE=0 ;;
|
||||
--no-config) WRITE_CONFIG=0 ;;
|
||||
--from-source) export SUNSHINE_PKG=sunshine ;;
|
||||
--doctor) DOCTOR_ONLY=1 ;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) err "Unknown option: $1"; usage; exit 2 ;;
|
||||
esac
|
||||
@@ -64,6 +78,14 @@ main() {
|
||||
detect_all
|
||||
info "Host: $HOSTNAME_SHORT GPU: $GPU_VENDOR Session: $SESSION_TYPE"
|
||||
|
||||
if [[ $DOCTOR_ONLY -eq 1 ]]; then
|
||||
verify_install
|
||||
exit $(( VERIFY_FAILURES > 0 ? 1 : 0 ))
|
||||
fi
|
||||
|
||||
step "Preflight checks"
|
||||
preflight_all
|
||||
|
||||
if [[ $INSTALL_SUNSHINE -eq 1 ]]; then
|
||||
step "Installing Sunshine and GPU encoder support"
|
||||
install_sunshine
|
||||
@@ -74,6 +96,13 @@ main() {
|
||||
ensure_uinput_udev_rule
|
||||
set_sunshine_capabilities
|
||||
|
||||
if [[ $WRITE_CONFIG -eq 1 ]]; then
|
||||
step "Writing tuned sunshine.conf"
|
||||
write_sunshine_config
|
||||
else
|
||||
info "Skipping sunshine.conf (--no-config)"
|
||||
fi
|
||||
|
||||
if [[ $FIREWALL -eq 1 ]]; then
|
||||
step "Configuring firewall for Sunshine ports"
|
||||
open_sunshine_ports
|
||||
@@ -98,6 +127,10 @@ main() {
|
||||
info "Skipping Moonlight install (--no-moonlight)"
|
||||
fi
|
||||
|
||||
if [[ $INSTALL_SUNSHINE -eq 1 ]]; then
|
||||
verify_install
|
||||
fi
|
||||
|
||||
step "Done"
|
||||
print_next_steps
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user