Assorted shell and Python scripts
1#!/usr/bin/env bash
2
3if ! command -v gum >/dev/null; then
4 echo "Gum command not found"
5 exit 0
6fi
7
8function gumstyle() {
9 GUMSTYLE=$(gum style --foreground="#cba6f7" "$1")
10 echo "${GUMSTYLE} : ${2}"
11}
12
13echo
14source /etc/os-release
15gum style --foreground="#f38ba8" "$(echo $PRETTY_NAME)"
16echo
17gumstyle "Kernel" "$(uname -sr)"
18gumstyle "Uptime" "$(uptime -p)"
19echo
20
21if [[ -f /etc/debian_version ]]; then
22 APT_PACKAGES=$(sudo apt update 2>/dev/null | grep packages | cut -d '.' -f 1 | awk '{print $1}')
23 gumstyle "APT updates" "$APT_PACKAGES"
24fi
25
26if [[ -f /etc/redhat-release ]]; then
27 DNF_PACKAGES=$(sudo dnf check-update | wc -l)
28 gumstyle "DNF updates" "$DNF_PACKAGES"
29fi
30
31if command -v flatpak >/dev/null; then
32 FLATPAK_PACKAGES=$(flatpak remote-ls --updates | wc -l)
33 gumstyle "Flatpak updates" "$FLATPAK_PACKAGES"
34fi
35
36if [[ -d /home/linuxbrew/.linuxbrew ]]; then
37 BREW_PACKAGES=$(cat /home/jas/.homebrew_updates)
38 gumstyle "Homebrew updates" "$BREW_PACKAGES"
39fi