Add quickinfo; refactor check-updates

This commit is contained in:
Jeffrey Serio 2025-01-22 12:28:58 -06:00
parent a7c5a0cc7f
commit 2cc0bf3824
2 changed files with 40 additions and 2 deletions

View File

@ -3,8 +3,7 @@
updates=() updates=()
if [[ -f /etc/debian_version ]]; then if [[ -f /etc/debian_version ]]; then
sudo apt update >/dev/null updates+=("[ APT: $(sudo apt update 2>/dev/null | grep packages | cut -d '.' -f 1 | awk '{print $1}') ]")
updates+=("[ APT: $(sudo apt list --upgradable | tr -d '\n' | wc -l) ]")
fi fi
if [[ -f /etc/redhat-release ]]; then if [[ -f /etc/redhat-release ]]; then

39
quickinfo Executable file
View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
if ! command -v gum >/dev/null; then
echo "Gum command not found"
exit 0
fi
function gumstyle() {
GUMSTYLE=$(gum style --foreground="#cba6f7" "$1")
echo "${GUMSTYLE} : ${2}"
}
echo
source /etc/os-release
gum style --foreground="#f38ba8" "$(echo $PRETTY_NAME)"
echo
gumstyle "Kernel" "$(uname -sr)"
gumstyle "Uptime" "$(uptime -p)"
echo
if [[ -f /etc/debian_version ]]; then
APT_PACKAGES=$(sudo apt update 2>/dev/null | grep packages | cut -d '.' -f 1 | awk '{print $1}')
gumstyle "APT updates" "$APT_PACKAGES"
fi
if [[ -f /etc/redhat-release ]]; then
DNF_PACKAGES=$(sudo dnf check-update | wc -l)
gumstyle "DNF updates" "$DNF_PACKAGES"
fi
if command -v flatpak >/dev/null; then
FLATPAK_PACKAGES=$(flatpak remote-ls --updates | wc -l)
gumstyle "Flatpak updates" "$FLATPAK_PACKAGES"
fi
if [[ -d /home/linuxbrew/.linuxbrew ]]; then
BREW_PACKAGES=$(cat /home/jas/.homebrew_updates)
gumstyle "Homebrew updates" "$BREW_PACKAGES"
fi