2023-02-09 14:49:10 +01:00
|
|
|
#!/bin/sh
|
2023-04-11 10:30:27 +02:00
|
|
|
|
2023-05-24 18:33:43 +02:00
|
|
|
big="\033[11m"
|
|
|
|
reset="\033[0m"
|
|
|
|
icon=""
|
2023-04-11 10:30:27 +02:00
|
|
|
|
2023-02-16 18:59:33 +01:00
|
|
|
if command -v pacman 1>/dev/null 2>&1; then
|
2024-01-02 19:09:46 +01:00
|
|
|
num="$(pacman -Qu | grep -Fcv "[ignored]")"
|
|
|
|
[ "$num" -gt 0 ] && printf "%b" "$big$icon$reset$num"
|
2023-02-16 18:59:33 +01:00
|
|
|
fi
|
2023-02-09 14:49:10 +01:00
|
|
|
|
2023-02-16 18:59:33 +01:00
|
|
|
if command -v apt 1>/dev/null 2>&1; then
|
2024-01-02 19:09:46 +01:00
|
|
|
vals=$(apt upgrade -sy 2>/dev/null | grep -m1 '^[0-9]\+ upgraded,' | tr -cd '0-9 ' | tr ' ' '\n' | grep '[0-9]\+' | xargs)
|
2023-02-09 14:49:10 +01:00
|
|
|
|
2024-01-02 19:09:46 +01:00
|
|
|
for i in $vals; do
|
|
|
|
[ "$i" != 0 ] && updates_available=yes
|
|
|
|
out="$out$i/"
|
|
|
|
done
|
2023-02-09 14:49:10 +01:00
|
|
|
|
2024-01-02 19:09:46 +01:00
|
|
|
[ -n "$updates_available" ] && printf "%b" "$big$icon$reset $(echo "$out" | sed 's/\/$//')" || exit 0
|
2023-02-09 14:49:10 +01:00
|
|
|
fi
|