#package #package-manager #root #command #xbps #tui #tasks

app xbps-tui

A TUI for managing daily tasks of the XBPS package manager

1 unstable release

new 0.2.2 Jan 20, 2025

#96 in Operating systems

MIT license

120KB
2.5K SLoC

XBPS-TUI

noMSgithub badge

An interactive terminal-based frontend for the xbps package manager, mainly used by Void Linux.

Its still in an experimental alpha stage and might be unstable. I've heavily tested all processes which need root permission, but as always with applications which work with the root system, you could break something if you're careless. I suggest always to use the --dry-run option and checking the output (via t) before executing the real command with root permissions.

Dependencies

For running the TUI you need the following programs installed:

  • xbps package manager, or course!
  • Void Linux as active OS (at least its only tested on Void).
  • For authentication when running root commands, you need at least one of these:
    • su via util-linux package. Should be preinstalled on almost any system
    • polkit for authentication when running root commands with a polkit-agent to authenticate through password (try my fuzzel-version if you still need one 😉)

Note: You might ask: "Why su and not the more commonly used sudo?"

Well, that's due to the fact that sudo allows 3 password attempts by default, while su only asks for the password one time and returns an error if it was wrong. Changing sudo behavior is not easy to do, because it needs to edit some system settings. Thus, su is an easier way to authenticate and directly return an error value if the attempt failed.

Installation

Cargo

You can simply install the TUI via cargo:

cargo install xbps-tui

Build from source

Or you build the TUI yourself:

git clone https://codeberg.org/lukeflo/xbps-tui
cd xbps-tui
cargo build || cargo install --path=.

Afterward, you can run the TUI via target/release/xbps-tui or simply xbps-tui, if installed system-wide.

CLI Arguments

Right now, xbps-tui only offers some very basic CLI flags:

Flag Description
-h|--help Show the help text and exit
-v|--version Show the version text and exit
--auth-method=<value> Set the authentication method for the upcoming session. Possible values are: su|sudo|polkit|pkexec, whereas the first pair as well as the last pair are just synonyms for each other. The default value is su.

Actions

My goal was not to provide all functionalities xbps offers. They are far too many. For rarely occurring use cases xtools offers some nice wrapper.

XBPS-Tui should make every-day tasks much more comfortable. Thus, the following actions are implemented at the moment (though, I'll add some more, see Roadmap).

Search Package List

: By hitting / or Ctrl+f you enter search mode. This allows to fuzzy search the current visible package list. The search pattern is matched against package name and description. To search for a fixed pattern add a ' at the beginning; to search for a fixed string at the beginning of the package name add a ^.

Fast Filter List

: By simply hitting h,k or , you can fast filter the list. The order is: full package list <> installed packages <> packages marked for installation <> packages marked for removal.

Mark Packages for Action

: By hitting space the currently selected package gets marked. Installed packages get will be marked for removal, not-installed packages for installation. To remove a single mark, just hit space again on the selected package. To remove all marks hit c.

Run xbps Command and Check Output

: To install all marked packages simply press I, to remove all marked packages press D. A dialog with different execution options pops up. After selecting one, you will be prompted for your root password. While the command is running you can move the list or search for packages, but it's not possible to run another command until the current one is finished. You can check the command output which would normally appear on the command line by pressing t.

Check package infos

: You can open the related homepage of the currently selected package by pressing o.

Roadmap

  • Filter list by marked packages/installed packages
  • Authentication via su/sudo. This would make it possible to run all tasks from inside the terminal.
  • Opening links for selected package
  • Fast installation/removal of single package

Logs

Since xbps-tui runs some commands which need root permission, important actions are logged. The logfile will be put into the standard data folder following XDG standard. On most Linux machines this defaults to $HOME/.local/share/xbps-tui/xbps-tui.log.

To change the location of the logfile temporary, pass the needed environment flag right before starting xbps-tui: XBPS_TUI_DATA="relative/path/to/logfile" xbps-tui.

impressions

2025-01-13-21-31-11.png

Searching the package list


2025-01-13-21-22-31.png

Selection dialog for action


2025-01-13-21-23-30.png

Authentication using polkit


2025-01-13-21-24-11.png

CLI output from xbps command in scrollable popup

Feedback

I'm thankful for any feedback. Regarding the functionality of the TUI please open an issue before opening a PR.

Feedback regarding code quality are also welcome, but for those kind please don't open any PR. Writing this program is kind of a Rust training for me. Therefore, I would like to implement code enhancements myself to learn something too.

Dependencies

~12–27MB
~348K SLoC