Files
steamify-cachyos/lib/common.sh
T
theupriser 4ad6c2c04e fix: Fix setup bugs, add SteamOS desktop look and LED driver, split into modules
- Fix session switching: sync bridge only edits [Autologin], sync service
  no longer hits systemd's start limit, re-runs don't duplicate settings
- Make the Return to Gaming Mode shortcut work without a password prompt
- Steam desktop autostart only runs in Plasma, not inside gamescope
- Vapor theme: fix install path, wallpaper, icon and color scheme; take
  over Valve's SteamOS defaults, GTK theme, panel layout and dark mode;
  always fetch the newest steamdeck-kde-presets with checksum verification
- Steam Machine: install kernel headers and build/load the leds-valve
  driver reliably; ask before installing OpenRGB
- Split the script into lib/ modules per responsibility
- Rewrite README for end users with a technical details section; add
  AGENTS.md
2026-09-23 14:24:06 +02:00

36 lines
1.3 KiB
Bash

#!/bin/bash
# Output helpers, prompts and small shared utilities.
# Sourced by setup-gamescope-boot.sh; not meant to be run on its own.
c_reset="\033[0m"; c_bold="\033[1m"; c_green="\033[32m"; c_yellow="\033[33m"; c_red="\033[31m"; c_cyan="\033[36m"
info() { echo -e "${c_cyan}[INFO]${c_reset} $*"; }
ok() { echo -e "${c_green}[OK]${c_reset} $*"; }
warn() { echo -e "${c_yellow}[WARN]${c_reset} $*"; }
err() { echo -e "${c_red}[ERROR] $*${c_reset}" >&2; }
ask_yn() {
local prompt="$1" default="${2:-y}" reply
local hint="[Y/n]"; [[ "$default" == "n" ]] && hint="[y/N]"
read -rp "$(echo -e "${c_bold}${prompt}${c_reset} ${hint} ")" reply
reply="${reply:-$default}"
[[ "$reply" =~ ^[Yy]$ ]]
}
require_root_helper() {
# Re-exec any privileged step through sudo rather than requiring the
# whole script to run as root, so $HOME/whoami stay correct for the
# target user detection below.
if [[ $EUID -eq 0 && -z "${SUDO_USER:-}" ]]; then
err "Please run this script as your normal user (it will call sudo itself), not directly as root."
exit 1
fi
}
backup_file() {
local f="$1"
if [[ -f "$f" && ! -f "${f}.bak-gamescope-wizard" ]]; then
sudo cp -a "$f" "${f}.bak-gamescope-wizard"
info "Backed up $f -> ${f}.bak-gamescope-wizard"
fi
}