1
0
Fork 0
mirror of synced 2024-12-25 09:23:23 -05:00

Add reboot icon next to full system update text if the user has not rebooted since the last full update

This commit is contained in:
TNE 2022-03-13 16:10:53 +01:00
parent 4907183622
commit 6089e29bd9
2 changed files with 21 additions and 12 deletions

View file

@ -2,7 +2,7 @@
# Maintainer: Librewish <librewish@gmail.com>
pkgname=garuda-common-settings
pkgver=2.5.5
pkgver=2.5.6
pkgrel=1
arch=('any')
url="https://gitlab.com/garuda-linux/themes-and-settings/settings/$pkgname"

View file

@ -16,15 +16,15 @@ detect_dual_boot() {
detect_snapshots() {
if [ -d /.snapshots ] || pacman -Qq snapper-support &> /dev/null; then
SNAPSHOTS="Snapper"
echo "Snapper"
elif [ -d /run/timeshift ] || pacman -Qq timeshift-support &> /dev/null; then
SNAPSHOTS="Timeshift"
echo "Timeshift"
elif pacman -Qq snapper &> /dev/null; then
SNAPSHOTS="Snapper (maybe)"
echo "Snapper (maybe)"
elif pacman -Qq timeshift &> /dev/null; then
SNAPSHOTS="Timeshift (maybe)"
echo "Timeshift (maybe)"
else
SNAPSHOTS="None/Undetected"
echo "None/Undetected"
fi
}
@ -33,22 +33,31 @@ generate_relevant_software() {
systemctl is-enabled tlp &> /dev/null && RELEVANT+=("tlp")
systemctl is-active NetworkManager &> /dev/null && RELEVANT+=("NetworkManager")
systemctl is-active connman &> /dev/null && RELEVANT+=("connman")
RELEVANT_SOFTWARE="${RELEVANT[*]}"
local RELEVANT_SOFTWARE="${RELEVANT[*]}"
[ -z "$RELEVANT_SOFTWARE" ] && RELEVANT_SOFTWARE="None"
echo "$RELEVANT_SOFTWARE"
}
generate_system_update() {
local last_update
last_update="$(date -r /var/lib/garuda/last_update +%s 2> /dev/null)" || { echo "Unknown/Never"; return; }
local reboot=""
if [ "$last_update" -gt "$(date -r /proc +%s)" ]; then
reboot=" \033[1;31m↻"
fi
echo -e "$(date -d"@$last_update" +%F)${reboot}"
}
[ -t 0 ] && inxi -Faz || inxi -Fazc0
echo -e "\033[1;34mGaruda ($(pacman -Q garuda-common-settings | awk '{print $2}')):\033[0m"
install_date="$(head -n1 /var/log/pacman.log | cut -d " " -f1 | cut -c 2-11)"
echo -e "\033[1;34m System install date:\033[0m ${install_date}"
echo -e "\033[1;34m Last full system update:\033[0m $(date -r /var/lib/garuda/last_update +%F 2> /dev/null || echo "Unknown/Never")"
echo -e "\033[1;34m Last full system update:\033[0m $(generate_system_update)"
echo -e "\033[1;34m Is partially upgraded: \033[0m $([ -e /var/lib/garuda/partial_upgrade ] && echo Yes || echo No)"
generate_relevant_software
echo -e "\033[1;34m Relevant software: \033[0m ${RELEVANT_SOFTWARE}"
echo -e "\033[1;34m Relevant software: \033[0m $(generate_relevant_software)"
detect_dual_boot &> /dev/null
echo -e "\033[1;34m Windows dual boot: \033[0m ${DUALBOOT}"
detect_snapshots
echo -e "\033[1;34m Snapshots: \033[0m ${SNAPSHOTS}"
echo -e "\033[1;34m Snapshots: \033[0m $(detect_snapshots)"
echo -e "\033[1;34m Failed units: \033[0m $(systemctl list-units --failed --full --all --plain --no-legend | awk '{printf("%s ",$1)}')"
if [ "$1" == "funstuff" ]; then
update_count="$(paclog --grep="starting full system upgrade" | wc -l)"