22 releases

0.7.1 Mar 17, 2024
0.6.0 Jan 20, 2024
0.5.7 Oct 19, 2023
0.5.5 May 24, 2023
0.1.2 Nov 19, 2019

#91 in Command line utilities

Download history 1/week @ 2024-01-14 4/week @ 2024-02-18 191/week @ 2024-02-25 8/week @ 2024-03-03 17/week @ 2024-03-10 199/week @ 2024-03-17 2/week @ 2024-03-24 21/week @ 2024-03-31 4/week @ 2024-04-07

231 downloads per month

GPL-3.0-only

27KB
552 lines

Reboot Arch BTW

GitHub Workflow Status Crates.io Version Crates.io Downloads AUR version

This is a small utility which shows the installed and running Linux kernel on ArchLinux. It is useful if one didn't notice that the kernel got updated and suddenly your USB drive won't mount because the needed kernel module can't get loaded.

It can also detect if critical packages like systemd got updated which may also make a reboot necessary.

To get the version of the installed kernel it uses libalpm (shipped with pacman) to query the local pacman database. To get the version of the running kernel it uses uname -r.

Install

You may just install it from the AUR:

Alternatively one can install it with cargo:

cargo install reboot-arch-btw

Build

This project requires Rust 1.75.0 or newer. Also you need to have dbus installed.

sudo pacman -S dbus
cargo build

Usage

$ reboot-arch-btw
Kernel
 installed: 5.19.13.arch1.1 (since 4 minutes ago)
 running:   5.19.12.arch1.1
systemd updated 4 minutes ago
Reboot arch btw

It will also show a desktop notification indicating that you probably want to reboot your system.

One can use --reboot-packages or --reboot-packages to set the list of packages which should also trigger a notification if they are updated.

$ reboot-arch-btw --help
Check if a reboot is needed due to an updated kernel or other system packages.

Usage: reboot-arch-btw [OPTIONS]

Options:
      --disable-notification
          Disable desktop notification

      --notification-timeout <NOTIFICATION_TIMEOUT>
          Timeout for the desktop notification in milliseconds.

          * "default" will leave the timeout to be set by the server.

          * "never" or "0" will cause the notification never to expire.

          * Any other number will be interpreted as the timeout in milliseconds.

          [default: default]

      --reboot-packages <REBOOT_PACKAGES>
          Comma separated list of packages were we should reboot after an upgrade

          [default: systemd,linux-firmware,amd-ucode,intel-ucode]

      --session-restart-packages <SESSION_RESTART_PACKAGES>
          Comma separated list of packages were we should restart our session after an upgrade

          [default: xorg-server,xorg-xwayland]

  -h, --help
          Print help information (use `-h` for a summary)

  -V, --version
          Print version information

Pacman Hook

You can configure pacman to run reboot-arch-btw after every upgrade to check immediatly if you should reboot. For that create /etc/pacman.d/hooks/99-reboot-arch-btw.hook with the following content:

[Trigger]
Operation = Upgrade
Type = Package
Target = *

[Action]
Description = Check whether a reboot is required
Depends = reboot-arch-btw
When = PostTransaction
Exec = /usr/bin/sudo -u $USER DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID/bus /usr/bin/reboot-arch-btw

Note: You need to replace $USER and $UID with your actual username and user ID.

Dependencies

~4–32MB
~429K SLoC