refactor: start scripts as patches files, LED driver install in steps

This commit is contained in:
theupriser committed 2026-10-03 12:54:29 +02:00
1 parent 6080cd7491
commit 18e06797b3
6 files changed
+69 -60

No files matched your search

+1
View File
@@ -15,6 +15,7 @@ one per merged pull request.
- **ci: a Lint workflow runs shellcheck on the modules and helper scripts, ruff on the app and `patches/*.py` (`ruff.toml`) and qmllint on the QML (not blocking until it has run once on the runner); `make lint` runs the same locally**
- **refactor: `best_effort` for the steps whose failure doesn't matter (stopping or disabling units, removing packages, `modprobe -r`, ...): same behaviour, but their errors go to `~/.local/state/steamify/steamify.log` instead of `/dev/null`; temp dirs are registered with `make_tmpdir` and removed by the one exit handler (also when a run is interrupted), which replaces the menu's own `EXIT` trap**
- **refactor: the retired kernel pin moved out of `lib/steam-machine.sh` into `lib/kernel-pin.sh`**
- **refactor: the shortcut's two start scripts are files in `patches/` (`steamify-start.sh`, `steamify-app-start.sh`) instead of heredocs in `launcher_enable`, and the 83-line LED driver install is split into steps (`led_write_dkms_override`, `led_install_package`, `led_build_all_kernels`, `led_load_module`); what gets installed is byte-identical**
- **test: the menu rules, the plan and the app's and installer's JSON are checked against a golden file (`tests/menu-test.sh` in steamify-cachyos-dev); `make check`, `.editorconfig`, `.shellcheckrc`**
- **docs: README lists the sources and projects Steamify builds on, with licences and thanks**
+34 -25
View File
@@ -42,24 +42,7 @@ install_kernel_headers() {
sudo pacman -S --needed --noconfirm "${headers[@]}"
}
install_valve_led_driver() {
# Installs the leds-valve DKMS driver from the AUR so the front LED
# bar is exposed under /sys/class/leds/valve-leds[N].
local aur_helper
aur_helper="$(find_aur_helper)"
if [[ -z "$aur_helper" ]]; then
warn "No AUR helper available - can't install leds-valve-dkms-git."
warn "Install one yourself, then run: yay -S leds-valve-dkms-git"
return 1
fi
local -a flags
read -ra flags <<< "$(aur_noninteractive_flags "$aur_helper")"
# Headers first: without them the package installs fine but DKMS
# silently builds nothing, so modprobe later finds no module.
install_kernel_headers || return 1
led_write_dkms_override() {
# The upstream Makefile builds against `uname -r` instead of the kernel
# DKMS targets, so every other installed kernel (e.g. linux-cachyos-lts)
# got the running kernel's tree and failed (wrong kernel, and gcc against
@@ -74,17 +57,22 @@ install_valve_led_driver() {
err "Couldn't write $LED_DKMS_OVERRIDE; without it the LED driver only builds for the running kernel."
return 1
fi
}
if ! pacman -Qi leds-valve-dkms-git >/dev/null 2>&1; then
info "Installing leds-valve-dkms-git from the AUR via $aur_helper (non-interactive)..."
if ! "$aur_helper" -S "${flags[@]}" leds-valve-dkms-git; then
err "Installing leds-valve-dkms-git failed."
return 1
fi
else
led_install_package() {
# led_install_package <aur helper>
local aur_helper="$1"
local -a flags
read -ra flags <<< "$(aur_noninteractive_flags "$aur_helper")"
if pacman -Qi leds-valve-dkms-git >/dev/null 2>&1; then
ok "leds-valve-dkms-git already installed."
return 0
fi
info "Installing leds-valve-dkms-git from the AUR via $aur_helper (non-interactive)..."
"$aur_helper" -S "${flags[@]}" leds-valve-dkms-git || { err "Installing leds-valve-dkms-git failed."; return 1; }
}
led_build_all_kernels() {
# Build for every installed kernel that has headers, so booting another
# one (e.g. the LTS kernel) still has the driver.
local kdir kver
@@ -99,7 +87,9 @@ install_valve_led_driver() {
return 1
fi
done
}
led_load_module() {
# Load now, and on every boot.
echo leds-valve | sudo tee /etc/modules-load.d/leds-valve.conf >/dev/null
@@ -124,7 +114,26 @@ install_valve_led_driver() {
warn "No valve-leds nodes under /sys/class/leds/ yet. Reboot, then check with:"
warn " ls /sys/class/leds/ | grep valve ; sudo dmesg | grep -i valve"
fi
}
install_valve_led_driver() {
# Installs the leds-valve DKMS driver from the AUR so the front LED
# bar is exposed under /sys/class/leds/valve-leds[N].
local aur_helper
aur_helper="$(find_aur_helper)"
if [[ -z "$aur_helper" ]]; then
warn "No AUR helper available - can't install leds-valve-dkms-git."
warn "Install one yourself, then run: yay -S leds-valve-dkms-git"
return 1
fi
# Headers first: without them the package installs fine but DKMS
# silently builds nothing, so modprobe later finds no module.
install_kernel_headers || return 1
led_write_dkms_override || return 1
led_install_package "$aur_helper" || return 1
led_build_all_kernels || return 1
led_load_module
}
LED_UDEV_RULE="/etc/udev/rules.d/70-valve-leds-user.rules"
+3 -35
View File
@@ -48,43 +48,11 @@ launcher_repair() { [[ -f "$WIZARD_APPS/$WIZARD_OLD_NAME" ]] && ! launcher_statu
launcher_enable() {
info "Adding the Steamify shortcut (the app on the desktop and in the launcher, Steamify Terminal in the launcher)..."
install_executable "$WIZARD_LAUNCHER" 755 << EOF
#!/bin/bash
# Installed by Steamify CachyOS: run its newest release.
# pipefail: a failed download must count as a failure, not an empty script.
set -o pipefail
if ! curl -fsSL --max-time 30 "$WIZARD_URL" | bash; then
echo
echo "Couldn't download or run the wizard. Are you connected to the internet?"
echo
read -rp "Press Enter to close this window... " _
exit 1
fi
# Done: close the window after a countdown (Enter closes it right away).
echo
for (( i = 10; i > 0; i-- )); do
printf '\rClosing this window in %2d seconds (Enter to close now)... ' "\$i"
read -rs -t 1 _ && break
done
echo
EOF
# Both scripts download the newest release when they run (patches/).
patch_file steamify-start.sh | fill URL="$WIZARD_URL" | install_executable "$WIZARD_LAUNCHER" 755
# The app, without a terminal. Only the first time, when PySide6 still
# has to be installed, it runs in Konsole: sudo asks for the password there.
install_executable "$WIZARD_APP_LAUNCHER" 755 << EOF
#!/bin/bash
# Installed by Steamify CachyOS: start the newest release of its app.
set -o pipefail
if [[ "\${1:-}" != --in-terminal ]] && ! python3 -c 'import PySide6.QtQml' 2>/dev/null; then
exec konsole -e "\$0" --in-terminal
fi
if ! curl -fsSL --max-time 30 "$WIZARD_APP_URL" | bash; then
msg="Couldn't download or start Steamify. Are you connected to the internet?"
if [[ "\${1:-}" == --in-terminal ]]; then echo; echo "\$msg"; read -rp "Press Enter to close this window... " _
else kdialog --title Steamify --sorry "\$msg" 2>/dev/null; fi
exit 1
fi
EOF
patch_file steamify-app-start.sh | fill URL="$WIZARD_APP_URL" | install_executable "$WIZARD_APP_LAUNCHER" 755
# The icon comes with the release; without it, Steam's own icon.
local icon=steam tmp
+1
View File
@@ -16,3 +16,4 @@ read and reviewed on their own. `lib/*.sh` reads them with `patch_file
| `steamify-os-release.sh`, `steamify-os-release.hook` | `lib/login-manager.sh` (SteamOS conversion) | What Steam's System settings show besides the OS name (which stays CachyOS's): `VERSION_ID=steamos-X.Y`, `VERSION_CODENAME=steam-machine`, `VARIANT`/`VARIANT_ID` Steamify with its version, in `/etc/os-release`; the pacman hook runs it again after cachyos-hooks (`fill SCRIPT=... VERSION=... STEAMOS=...`) |
| `steamify-nvidia-initramfs.sh`, `steamify-nvidia-initramfs.hook` | `lib/nvidia.sh` (SteamOS conversion, NVIDIA fix) | The pacman hook (before the initramfs is built, after DKMS) and its script: the NVIDIA modules go into the initramfs only while every installed kernel has them, decided again at every kernel or driver change (`fill SCRIPT=...`) |
| `cros-ec-cec-single-port.patch` | `lib/cec.sh` (HDMI-CEC) | Makes Valve's Steam Machine CEC driver find amdgpu's HDMI port |
| `steamify-start.sh`, `steamify-app-start.sh` | `lib/wizard-shortcut.sh` (Steamify shortcut) | The two start scripts of the shortcut: "Steamify Terminal" runs the newest `steamify.sh` in Konsole, the app's launcher runs the newest `steamify-app.sh` (`fill URL=...`) |
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
# Installed by Steamify CachyOS: start the newest release of its app.
set -o pipefail
if [[ "${1:-}" != --in-terminal ]] && ! python3 -c 'import PySide6.QtQml' 2>/dev/null; then
exec konsole -e "$0" --in-terminal
fi
if ! curl -fsSL --max-time 30 "@URL@" | bash; then
msg="Couldn't download or start Steamify. Are you connected to the internet?"
if [[ "${1:-}" == --in-terminal ]]; then echo; echo "$msg"; read -rp "Press Enter to close this window... " _
else kdialog --title Steamify --sorry "$msg" 2>/dev/null; fi
exit 1
fi
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
# Installed by Steamify CachyOS: run its newest release.
# pipefail: a failed download must count as a failure, not an empty script.
set -o pipefail
if ! curl -fsSL --max-time 30 "@URL@" | bash; then
echo
echo "Couldn't download or run the wizard. Are you connected to the internet?"
echo
read -rp "Press Enter to close this window... " _
exit 1
fi
# Done: close the window after a countdown (Enter closes it right away).
echo
for (( i = 10; i > 0; i-- )); do
printf '\rClosing this window in %2d seconds (Enter to close now)... ' "$i"
read -rs -t 1 _ && break
done
echo