mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-03 17:41:58 +02:00
refactor: The session sync and kernel headers scripts in patches/
This commit is contained in:
1 parent
0883e7a501
commit
e2ad40dfb9
6 files changed
+36
-35
No files matched your search
+1
-18
@@ -185,24 +185,7 @@ install_session_sync() {
|
||||
local SYNC_SCRIPT="/usr/local/bin/sync-steamos-session.sh"
|
||||
info "Installing session sync bridge at $SYNC_SCRIPT"
|
||||
|
||||
sudo tee "$SYNC_SCRIPT" > /dev/null << 'EOF'
|
||||
#!/bin/bash
|
||||
SRC="/etc/plasmalogin.conf.d/zz-steamos-autologin.conf"
|
||||
DEST="/etc/plasmalogin.conf"
|
||||
|
||||
[[ -f "$SRC" ]] || exit 0
|
||||
SESSION=$(grep -oP '^Session=\K.*' "$SRC")
|
||||
[[ -z "$SESSION" ]] && exit 0
|
||||
|
||||
# Only touch Session= inside [Autologin]; other sections may have their own.
|
||||
if sed -n '/^\[Autologin\]/,/^\[/p' "$DEST" | grep -q '^Session='; then
|
||||
sed -i "/^\[Autologin\]/,/^\[/ s|^Session=.*|Session=$SESSION|" "$DEST"
|
||||
elif grep -q '^\[Autologin\]' "$DEST"; then
|
||||
sed -i "/^\[Autologin\]/a Session=$SESSION" "$DEST"
|
||||
else
|
||||
printf '\n[Autologin]\nSession=%s\n' "$SESSION" >> "$DEST"
|
||||
fi
|
||||
EOF
|
||||
patch_file sync-steamos-session.sh | sudo tee "$SYNC_SCRIPT" > /dev/null
|
||||
|
||||
sudo chmod +x "$SYNC_SCRIPT"
|
||||
ok "Sync script installed."
|
||||
|
||||
+1
-16
@@ -295,22 +295,7 @@ install_headers_boot_check() {
|
||||
# So check at every boot and install missing headers, which triggers
|
||||
# that hook and builds the driver for the new kernel.
|
||||
sudo mkdir -p "$(dirname "$HEADERS_SCRIPT")"
|
||||
sudo tee "$HEADERS_SCRIPT" > /dev/null << 'EOF'
|
||||
#!/bin/bash
|
||||
# Installed by cachyos-gamescope-boot: install missing -headers for every
|
||||
# installed kernel, so DKMS builds leds-valve for it.
|
||||
set -u
|
||||
missing=()
|
||||
for k in $(pacman -Qqo /usr/lib/modules/*/pkgbase 2>/dev/null | sort -u); do
|
||||
pacman -Q "${k}-headers" >/dev/null 2>&1 && continue
|
||||
pacman -Si "${k}-headers" >/dev/null 2>&1 && missing+=("${k}-headers")
|
||||
done
|
||||
[[ ${#missing[@]} -eq 0 ]] && exit 0
|
||||
# Another pacman is running (e.g. an update): try again next boot.
|
||||
[[ -e /var/lib/pacman/db.lck ]] && { echo "pacman is busy, skipping"; exit 0; }
|
||||
echo "Installing missing kernel headers: ${missing[*]}"
|
||||
exec pacman -S --needed --noconfirm "${missing[@]}"
|
||||
EOF
|
||||
patch_file ensure-kernel-headers.sh | sudo tee "$HEADERS_SCRIPT" > /dev/null
|
||||
sudo chmod 755 "$HEADERS_SCRIPT"
|
||||
service_file ensure-kernel-headers.service HEADERS_SCRIPT="$HEADERS_SCRIPT" | sudo tee "$HEADERS_UNIT" > /dev/null
|
||||
sudo systemctl daemon-reload
|
||||
|
||||
Reference in new issue
Block a user