Sets up bidirectional game streaming across Omarchy/Hyprland/Wayland machines (NVIDIA desktop and AMD Framework laptop), with the Macbook as an additional Moonlight client. The same install.sh runs on either machine; GPU vendor is detected at runtime and the appropriate hardware-encode packages are installed. Includes: - KMS capture setup (cap_sys_admin on sunshine, input group, uinput udev rule) - ufw / firewalld port opening when a firewall is active - systemd --user service + loginctl enable-linger for always-on hosting - uninstall.sh with --purge for user data removal - Flags to install host-only or client-only
63 lines
1.6 KiB
Bash
63 lines
1.6 KiB
Bash
#!/usr/bin/env bash
|
|
# Shared helpers: logging, sudo, preflight checks, idempotency primitives.
|
|
|
|
if [[ -t 1 ]]; then
|
|
BOLD=$'\033[1m'
|
|
DIM=$'\033[2m'
|
|
RED=$'\033[31m'
|
|
GREEN=$'\033[32m'
|
|
YELLOW=$'\033[33m'
|
|
BLUE=$'\033[34m'
|
|
RESET=$'\033[0m'
|
|
else
|
|
BOLD="" DIM="" RED="" GREEN="" YELLOW="" BLUE="" RESET=""
|
|
fi
|
|
|
|
step() { printf '\n%s==>%s %s%s%s\n' "$BLUE" "$RESET" "$BOLD" "$*" "$RESET"; }
|
|
info() { printf ' %s\n' "$*"; }
|
|
ok() { printf ' %s✓%s %s\n' "$GREEN" "$RESET" "$*"; }
|
|
warn() { printf ' %s!%s %s\n' "$YELLOW" "$RESET" "$*" >&2; }
|
|
err() { printf ' %s✗%s %s\n' "$RED" "$RESET" "$*" >&2; }
|
|
|
|
# Run as root via sudo, preserving prompt visibility.
|
|
as_root() { sudo "$@"; }
|
|
|
|
require_not_root() {
|
|
if [[ $EUID -eq 0 ]]; then
|
|
err "Do not run this script as root. It will sudo where needed."
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
require_arch() {
|
|
if [[ ! -f /etc/arch-release ]] && ! grep -q '^ID=arch' /etc/os-release 2>/dev/null; then
|
|
err "This script targets Arch Linux (Omarchy). /etc/arch-release not found."
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
require_yay() {
|
|
if ! command -v yay >/dev/null 2>&1; then
|
|
err "yay is required to install AUR packages. Install yay first."
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
# True if package is installed (pacman -Qi).
|
|
pkg_installed() { pacman -Qi "$1" >/dev/null 2>&1; }
|
|
|
|
# Install one or more packages via yay if any are missing.
|
|
yay_install() {
|
|
local missing=()
|
|
local p
|
|
for p in "$@"; do
|
|
pkg_installed "$p" || missing+=("$p")
|
|
done
|
|
if [[ ${#missing[@]} -eq 0 ]]; then
|
|
ok "Already installed: $*"
|
|
return 0
|
|
fi
|
|
info "Installing: ${missing[*]}"
|
|
yay -S --needed --noconfirm "${missing[@]}"
|
|
}
|