mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-03 17:41:58 +02:00
refactor: DKMS confs in patches/; an existing leds-valve DKMS override is kept and restored
This commit is contained in:
1 parent
e2ad40dfb9
commit
ca500c995f
10 files changed
+62
-21
No files matched your search
@@ -154,7 +154,9 @@ gamescope and the Plasma desktop. Primary target: the Valve Steam Machine
|
||||
`restart_plasmashell_if_stopped` (`lib/common.sh`).
|
||||
- LED driver: `leds-valve-dkms-git`'s Makefile builds against `uname -r`,
|
||||
not DKMS's target kernel: `/etc/dkms/leds-valve-dkms.conf` sets
|
||||
`MAKE[0]="make KVERSION=${kernelver}"` (written before the AUR install).
|
||||
`MAKE[0]="make KVERSION=${kernelver}"` (written before the AUR install;
|
||||
someone's own override there is backed up, kept with ours appended, and
|
||||
restored on disable).
|
||||
Without it, other kernels build against the running kernel's tree and
|
||||
fail (CachyOS kernels are clang-built; DKMS adds `LLVM=1` only for the
|
||||
target's tree). Headers for every installed kernel are installed first,
|
||||
|
||||
+2
-1
@@ -7,7 +7,8 @@ one per merged pull request.
|
||||
|
||||
## 2.5.0 - 2026-09-27
|
||||
|
||||
- **refactor: The session sync and kernel headers scripts in patches/**
|
||||
- **refactor: DKMS confs in patches/; an existing leds-valve DKMS override is kept and restored**
|
||||
- `bd4fa3a` **refactor: The session sync and kernel headers scripts in patches/**
|
||||
- `8ffa0f2` **refactor: systemd units in services/, read with service_file like patches/**
|
||||
- `8a2601d` **docs: README screenshot at 2.5.0 with Update notifications; AGENTS.md: retake it when rows change**
|
||||
- `572417b` **fix: Open Steamify from the notification starts the app (own scope), the same way it was last used (app or terminal)**
|
||||
|
||||
+1
-4
@@ -76,10 +76,7 @@ cec_driver_enable() {
|
||||
patch_file cros-ec-cec-single-port.patch | patch -s -d "$tmp" -p1 ||
|
||||
{ rm -rf "$tmp"; err "Patching Valve's CEC driver failed."; return 1; }
|
||||
echo 'obj-m += cros-ec-cec.o' >"$tmp/Makefile"
|
||||
printf '%s\n' "# Written by Steamify: Valve's cros_ec_cec, which knows the Steam Machine." \
|
||||
"PACKAGE_NAME=\"$CEC_DKMS_NAME\"" "PACKAGE_VERSION=\"$CEC_DKMS_VER\"" \
|
||||
'BUILT_MODULE_NAME[0]="cros-ec-cec"' 'DEST_MODULE_LOCATION[0]="/updates/dkms"' \
|
||||
'AUTOINSTALL="yes"' >"$tmp/dkms.conf"
|
||||
patch_file "$CEC_DKMS_NAME.dkms.conf" | fill NAME="$CEC_DKMS_NAME" VERSION="$CEC_DKMS_VER" >"$tmp/dkms.conf"
|
||||
sudo dkms remove "$CEC_DKMS_NAME/$CEC_DKMS_VER" --all >/dev/null 2>&1
|
||||
sudo rm -rf "$CEC_DKMS_SRC"
|
||||
sudo install -d "$CEC_DKMS_SRC" && sudo install -m644 "$tmp"/{cros-ec-cec.c,Makefile,dkms.conf} "$CEC_DKMS_SRC/"
|
||||
|
||||
+8
-7
@@ -9,16 +9,17 @@ ok() { echo -e "${c_green}[OK]${c_reset} $*"; }
|
||||
# patch_file <name>: a file from patches/ (module sources, patches). The
|
||||
# single-file build replaces this with one that has them embedded.
|
||||
patch_file() { cat "$SCRIPT_DIR/patches/$1"; }
|
||||
# service_file <name> [KEY=value...]: a systemd unit from services/, with
|
||||
# each @KEY@ replaced by its value. The single-file build replaces
|
||||
# service_raw like patch_file.
|
||||
# service_file <name> [KEY=value...]: a systemd unit from services/, filled
|
||||
# in. The single-file build replaces service_raw like patch_file.
|
||||
service_raw() { cat "$SCRIPT_DIR/services/$1"; }
|
||||
service_file() {
|
||||
local name="$1" kv
|
||||
service_file() { local name="$1"; shift; service_raw "$name" | fill "$@"; }
|
||||
# fill [KEY=value...]: stdin with each @KEY@ replaced by its value (paths,
|
||||
# names; no "|" in them).
|
||||
fill() {
|
||||
local kv
|
||||
local -a subst=(-e '')
|
||||
shift
|
||||
for kv in "$@"; do subst+=(-e "s|@${kv%%=*}@|${kv#*=}|g"); done
|
||||
service_raw "$name" | sed "${subst[@]}"
|
||||
sed "${subst[@]}"
|
||||
}
|
||||
warn() { echo -e "${c_yellow}[WARN]${c_reset} $*"; }
|
||||
err() { echo -e "${c_red}[ERROR] $*${c_reset}" >&2; }
|
||||
|
||||
@@ -28,10 +28,7 @@ poweroff_fix_enable() {
|
||||
tmp="$(mktemp -d)"
|
||||
patch_file "$POWEROFF_DKMS_NAME.c" > "$tmp/$POWEROFF_DKMS_NAME.c"
|
||||
echo "obj-m += $POWEROFF_DKMS_NAME.o" >"$tmp/Makefile"
|
||||
printf '%s\n' "# Written by Steamify: the Steam Machine powers off instead of booting up again." \
|
||||
"PACKAGE_NAME=\"$POWEROFF_DKMS_NAME\"" "PACKAGE_VERSION=\"$POWEROFF_DKMS_VER\"" \
|
||||
"BUILT_MODULE_NAME[0]=\"$POWEROFF_DKMS_NAME\"" 'DEST_MODULE_LOCATION[0]="/updates/dkms"' \
|
||||
'AUTOINSTALL="yes"' >"$tmp/dkms.conf"
|
||||
patch_file "$POWEROFF_DKMS_NAME.dkms.conf" | fill NAME="$POWEROFF_DKMS_NAME" VERSION="$POWEROFF_DKMS_VER" >"$tmp/dkms.conf"
|
||||
sudo dkms remove "$POWEROFF_DKMS_NAME/$POWEROFF_DKMS_VER" --all >/dev/null 2>&1
|
||||
sudo rm -rf "$POWEROFF_DKMS_SRC"
|
||||
sudo install -d "$POWEROFF_DKMS_SRC" &&
|
||||
|
||||
+30
-3
@@ -224,9 +224,11 @@ install_valve_led_driver() {
|
||||
# a clang-built tree). DKMS reads this override after the package's
|
||||
# dkms.conf; written before the install so its own build works too.
|
||||
# On a fresh system dkms isn't installed yet, so /etc/dkms doesn't exist.
|
||||
# Someone's own override is backed up and kept, with ours after it: it's
|
||||
# sourced as bash, so our MAKE[0] wins.
|
||||
sudo mkdir -p "$(dirname "$LED_DKMS_OVERRIDE")"
|
||||
if ! printf '%s\n' "# Written by cachyos-gamescope-boot: build for DKMS's target kernel." \
|
||||
'MAKE[0]="make KVERSION=${kernelver}"' | sudo tee "$LED_DKMS_OVERRIDE" >/dev/null; then
|
||||
if ! led_dkms_override | sudo tee "$LED_DKMS_OVERRIDE.new" >/dev/null ||
|
||||
! sudo mv -f "$LED_DKMS_OVERRIDE.new" "$LED_DKMS_OVERRIDE"; then
|
||||
err "Couldn't write $LED_DKMS_OVERRIDE; without it the LED driver only builds for the running kernel."
|
||||
return 1
|
||||
fi
|
||||
@@ -285,6 +287,30 @@ install_valve_led_driver() {
|
||||
|
||||
LED_UDEV_RULE="/etc/udev/rules.d/70-valve-leds-user.rules"
|
||||
LED_DKMS_OVERRIDE="/etc/dkms/leds-valve-dkms.conf"
|
||||
|
||||
led_dkms_override() {
|
||||
# The override to write: an existing one's own lines (backed up the first
|
||||
# time), without ours from an earlier run, then ours. Before 2.5.0 the
|
||||
# file was ours alone, with a different comment.
|
||||
local ours
|
||||
ours="$(patch_file leds-valve-dkms.conf)"
|
||||
if [[ -f "$LED_DKMS_OVERRIDE" ]]; then
|
||||
grep -qxF -f <(echo "$ours") "$LED_DKMS_OVERRIDE" ||
|
||||
grep -q '^# Written by cachyos-gamescope-boot' "$LED_DKMS_OVERRIDE" ||
|
||||
backup_file "$LED_DKMS_OVERRIDE" >&2
|
||||
grep -vxF -f <(echo "$ours") "$LED_DKMS_OVERRIDE" | grep -v '^# Written by cachyos-gamescope-boot'
|
||||
fi
|
||||
echo "$ours"
|
||||
}
|
||||
|
||||
led_dkms_override_remove() {
|
||||
# Puts someone's own override back, or removes ours.
|
||||
if [[ -f "$LED_DKMS_OVERRIDE.bak-gamescope-wizard" ]]; then
|
||||
sudo mv -f "$LED_DKMS_OVERRIDE.bak-gamescope-wizard" "$LED_DKMS_OVERRIDE"
|
||||
else
|
||||
sudo rm -f "$LED_DKMS_OVERRIDE"
|
||||
fi
|
||||
}
|
||||
HEADERS_SCRIPT="/usr/local/lib/cachyos-gamescope-boot/ensure-kernel-headers"
|
||||
HEADERS_UNIT="/etc/systemd/system/ensure-kernel-headers.service"
|
||||
|
||||
@@ -404,7 +430,8 @@ machine_disable() {
|
||||
krevert machine
|
||||
reload_powerdevil
|
||||
sudo systemctl disable ensure-kernel-headers.service 2>/dev/null
|
||||
sudo rm -f "$LED_DKMS_OVERRIDE" "$HEADERS_UNIT" "$HEADERS_SCRIPT"
|
||||
led_dkms_override_remove
|
||||
sudo rm -f "$HEADERS_UNIT" "$HEADERS_SCRIPT"
|
||||
sudo rmdir "$(dirname "$HEADERS_SCRIPT")" 2>/dev/null
|
||||
sudo systemctl daemon-reload
|
||||
ok "Steam Machine support removed (the AUR helper, if installed, is kept)."
|
||||
|
||||
+3
-1
@@ -2,12 +2,14 @@
|
||||
|
||||
Files Steamify builds or applies, kept out of the shell code so they can be
|
||||
read and reviewed on their own. `lib/*.sh` reads them with `patch_file
|
||||
<name>`; the single-file build (`.github/tools/bundle.sh`) embeds them.
|
||||
<name>` (piped through `fill KEY=value...` for `@KEY@` placeholders); the single-file build (`.github/tools/bundle.sh`) embeds them.
|
||||
|
||||
| File | Used by | What |
|
||||
|---|---|---|
|
||||
| `steamify-fremont-poweroff.c` | `lib/fremont-poweroff.sh` (Steam Machine support) | Kernel module (DKMS): clears GPIO 18's S4/S5 wake bit before power-off, so the Steam Machine stays off with recent kernels |
|
||||
| `sync-steamos-session.sh` | `lib/login-manager.sh` (SteamOS conversion, plasma-login-manager) | The sync bridge: copies Steam's session choice from `zz-steamos-autologin.conf` into `plasmalogin.conf`'s `[Autologin]` |
|
||||
| `ensure-kernel-headers.sh` | `lib/steam-machine.sh` (Steam Machine support) | Run at boot: installs missing headers for every installed kernel |
|
||||
| `leds-valve-dkms.conf` | `lib/steam-machine.sh` (Steam Machine support) | `/etc/dkms` override: build the LED driver for DKMS's target kernel; appended to someone's own override, which is backed up and restored |
|
||||
| `steamify-fremont-poweroff.dkms.conf`, `steamify-cros-ec-cec.dkms.conf` | `lib/fremont-poweroff.sh`, `lib/cec.sh` | The DKMS modules' `dkms.conf` (`fill NAME=... VERSION=...`) |
|
||||
| `steamify-notifier.py` | `lib/update-notifier.sh` (Update notifications) | The daily check: notification and tray icon when there's a new release |
|
||||
| `cros-ec-cec-single-port.patch` | `lib/cec.sh` (HDMI-CEC) | Makes Valve's Steam Machine CEC driver find amdgpu's HDMI port |
|
||||
@@ -0,0 +1,2 @@
|
||||
# Written by Steamify: build leds-valve for DKMS's target kernel, not the running one.
|
||||
MAKE[0]="make KVERSION=${kernelver}"
|
||||
@@ -0,0 +1,6 @@
|
||||
# Written by Steamify: Valve's cros_ec_cec, which knows the Steam Machine.
|
||||
PACKAGE_NAME="@NAME@"
|
||||
PACKAGE_VERSION="@VERSION@"
|
||||
BUILT_MODULE_NAME[0]="cros-ec-cec"
|
||||
DEST_MODULE_LOCATION[0]="/updates/dkms"
|
||||
AUTOINSTALL="yes"
|
||||
@@ -0,0 +1,6 @@
|
||||
# Written by Steamify: the Steam Machine powers off instead of booting up again.
|
||||
PACKAGE_NAME="@NAME@"
|
||||
PACKAGE_VERSION="@VERSION@"
|
||||
BUILT_MODULE_NAME[0]="@NAME@"
|
||||
DEST_MODULE_LOCATION[0]="/updates/dkms"
|
||||
AUTOINSTALL="yes"
|
||||
Reference in new issue
Block a user