34 lines
565 B
Bash
Executable file
34 lines
565 B
Bash
Executable file
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
req_restart_prefix=(
|
|
glibc
|
|
linux
|
|
systemd
|
|
)
|
|
|
|
function get_grep() {
|
|
local IFS_bak="${IFS}"
|
|
IFS="|"
|
|
echo "${req_restart_prefix[*]}"
|
|
IFS="${IFS_bak}"
|
|
}
|
|
|
|
updates=$(checkupdates)
|
|
|
|
num=$(echo "${updates}" | grep -c -- '->' || true)
|
|
|
|
# No updates: Gray
|
|
color="#7f7f7f"
|
|
display_num=""
|
|
|
|
# Normal updates: White
|
|
[ $num -gt 0 ] && {
|
|
color="#ffffff"
|
|
display_num=" ${num}"
|
|
}
|
|
|
|
# Requires reboot: Red
|
|
(echo "${updates}" | grep -qE "^($(get_grep))") && color="#dd0000"
|
|
|
|
printf '<span color="%s">\uf0ad%s</span>\n' "${color}" "${display_num}"
|