mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-03 17:41:58 +02:00
refactor: start scripts as patches files, LED driver install in steps
This commit is contained in:
1 parent
6080cd7491
commit
18e06797b3
6 files changed
+69
-60
No files matched your search
+34
-25
@@ -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
@@ -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
|
||||
|
||||
Reference in new issue
Block a user