feat: pkg install/remove toggle and sudo-toggle function #20

Merged
rootiest merged 2 commits from feat/pkg-toggle-and-sudo-toggle into main 2026-05-26 17:10:50 +00:00
Owner

Summary

  • pkg toggle: pkg <name>... now auto-detects whether each package is installed and installs or removes it accordingly. Force install (-i) and force uninstall (-u) flags added for when you want to skip detection. Shows help when called with no arguments.
  • sudo-toggle: New system function that toggles sudo password enforcement on/off by writing/clearing a NOPASSWD rule in /etc/sudoers.d/nofail-toggle. Useful for temporarily bypassing FIDO key prompts during batch admin tasks.
  • README: Both functions documented in their respective sections.

Manual Verification

  • Run pkg ripgrep on a machine where ripgrep is not installed — confirm it installs via paru/yay.
  • Run pkg ripgrep again (now installed) — confirm it removes the package (-Rns).
  • Run pkg -i ripgrep when already installed — confirm it force-installs without removing.
  • Run pkg -u ripgrep when installed — confirm it force-uninstalls.
  • Run sudo-toggle once — confirm it prints 🔓 Sudo security: DISABLED and sudo works without a password prompt.
  • Run sudo-toggle again — confirm it prints 🔒 Sudo security: ENABLED and sudo requires authentication.
## Summary - **`pkg` toggle**: `pkg <name>...` now auto-detects whether each package is installed and installs or removes it accordingly. Force install (`-i`) and force uninstall (`-u`) flags added for when you want to skip detection. Shows help when called with no arguments. - **`sudo-toggle`**: New system function that toggles sudo password enforcement on/off by writing/clearing a `NOPASSWD` rule in `/etc/sudoers.d/nofail-toggle`. Useful for temporarily bypassing FIDO key prompts during batch admin tasks. - **README**: Both functions documented in their respective sections. ## Manual Verification - [x] Run `pkg ripgrep` on a machine where ripgrep is **not** installed — confirm it installs via paru/yay. - [x] Run `pkg ripgrep` again (now installed) — confirm it removes the package (`-Rns`). - [x] Run `pkg -i ripgrep` when already installed — confirm it force-installs without removing. - [x] Run `pkg -u ripgrep` when installed — confirm it force-uninstalls. - [x] Run `sudo-toggle` once — confirm it prints `🔓 Sudo security: DISABLED` and `sudo` works without a password prompt. - [x] Run `sudo-toggle` again — confirm it prints `🔒 Sudo security: ENABLED` and `sudo` requires authentication.
rootiest added 2 commits 2026-05-26 17:10:08 +00:00
pkg now auto-detects whether each package is installed and
installs or removes accordingly. Explicit -i/--install and
-u/--uninstall flags override the auto-detection. Adds help
output when invoked without arguments.
Toggles sudo password enforcement on/off by writing or
truncating a NOPASSWD rule in /etc/sudoers.d/nofail-toggle.
Useful for temporarily bypassing FIDO key prompts during
batch admin tasks without permanently weakening sudoers.
rootiest merged commit 013cf95478 into main 2026-05-26 17:10:50 +00:00
rootiest deleted branch feat/pkg-toggle-and-sudo-toggle 2026-05-26 17:10:50 +00:00
Sign in to join this conversation.