Files
fish-config/functions/limine-edit.fish
T
rootiest 037588ecf6 fix(help): stop eight functions executing on --help
These eight ignore $argv entirely, so passing --help ran the command
instead of describing it. The new check shadows every external binary
they reach with a recording stub on PATH and fails if anything is
invoked. Before the fix it reported, verbatim:

    cleanup --help EXECUTED: pacman -Qtdq
    fzf-update --help EXECUTED: git clone --depth 1 https://github.com/junegunn/fzf.git /tmp/.../.fzf
    limine-edit --help EXECUTED: sudoedit /boot/limine.conf sudo limine-enroll-config sudo limine-mkinitcpio sudo sbctl sign-all
    lock --help EXECUTED: loginctl lock-session
    screensleep --help EXECUTED: busctl --user call org.kde.kglobalaccel ... invokeShortcut s Turn Off Screen
    sudo-toggle --help EXECUTED: sudo stat -c %s /etc/sudoers.d/nofail-toggle sudo tee /etc/sudoers.d/nofail-toggle
    tmux-clean --help EXECUTED: tmux list-sessions -F #{session_name} #{session_attached}
    upgrade --help EXECUTED: paru -Syu --noconfirm

cleanup's log line is the read that precedes `sudo pacman -Rns $orphans`,
which the stub suppressed by returning no orphans; on a real machine with
orphans present the removal ran.

Each now answers --help from its own comment header. The call site is the
first statement of the body, above the C4 guard, so help stays reachable
when the component is disabled and nothing side-effecting runs first.
2026-09-07 20:04:02 -04:00

39 lines
1.2 KiB
Fish

# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# CATEGORY
# 07-system-and-monitoring
#
# SYNOPSIS
# limine-edit
#
# DESCRIPTION
# Opens /boot/limine.conf in sudoedit, then re-enrolls the config hash,
# runs CachyOS boot hooks (limine-mkinitcpio), and re-signs all Secure Boot
# files tracked by sbctl. Combines the edit and sign steps into a single
# command.
#
# EXAMPLE
# limine-edit
function limine-edit --description 'Safely edit and re-verify Limine configuration'
__fish_help_header (status current-function) $argv; and return 0
# 1. Open the config with sudoedit
sudoedit /boot/limine.conf
# 2. Re-enroll the config hash (This prevents the Checksum Panic)
echo "Enrolling Limine config..."
sudo limine-enroll-config
# 3. Run the CachyOS boot hooks (Updates snapshots/kernel links)
echo "Running CachyOS boot hooks..."
sudo limine-mkinitcpio
# 4. Sign any unsigned files tracked by sbctl
# 'sbctl sign-all' will re-apply signatures to everything in the database
echo "Verifying Secure Boot signatures..."
sudo sbctl sign-all
echo "✅ Limine config updated and verified. Ready for reboot."
end