NoSignal-OS/os updates/updates-panel/patch-updates-page.sh
28allday 19fd794b6b NoSignal — fully-offline Arch → Hyprland desktop installer
Single-script builder (nosignal.sh) that turns a stock Arch Linux ISO into a
fully-offline installer for a themed Hyprland + caelestia (Quickshell) desktop:
matching SDDM greeter, Btrfs/Limine bootable snapshots, chwd-style GPU
detection, and a curated "os updates" layer (keybind cheatsheet, settings
panels, system polish, on-box management skill). See README.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 11:03:10 +01:00

36 lines
1.6 KiB
Bash
Executable file

#!/bin/sh
# patch-updates-page.sh — register the NoSignal Updates page in caelestia-shell.
# Runs as root (via sudo from the installer, or via the pacman hook after every
# caelestia-shell upgrade, which reverts PageCompRegistry.qml). Idempotent.
#
# What it does:
# 1. copies UpdatesPage.qml (next to this script) into the shell's pages/ dir
# (an untracked file — pacman upgrades leave it alone)
# 2. swaps the FIRST "System" PlaceholderComp in PageCompRegistry.qml (the
# Updates stub) for a StackPage hosting UpdatesPage
set -eu
SELF_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
NEXUS=/etc/xdg/quickshell/caelestia/modules/nexus
REG="$NEXUS/PageCompRegistry.qml"
[ -f "$REG" ] || { echo "caelestia-shell not found at $NEXUS — nothing to patch"; exit 0; }
install -m 0644 "$SELF_DIR/UpdatesPage.qml" "$NEXUS/pages/UpdatesPage.qml"
if grep -q 'UpdatesPage' "$REG"; then
echo ":: registry already patched"
exit 0
fi
cp -n "$REG" "$REG.pre-nosignal"
perl -0pi -e 's/(\/\/ System\s*\n\s*)Component \{\s*\n\s*PlaceholderComp \{\}\s*\n\s*\},/$1Component {\n \/\/ Updates (NoSignal)\n StackPage {\n Component {\n UpdatesPage {}\n }\n }\n },/' "$REG"
if grep -q 'UpdatesPage' "$REG"; then
echo ":: patched $REG (Updates page registered)"
else
echo "WARNING: patch did not apply — upstream PageCompRegistry.qml changed shape." >&2
echo " The Updates page is installed but not registered; update the regex" >&2
echo " in $(basename "$0") for the new caelestia-shell version." >&2
fi