cfg/.config/i3blocks/arch-update

25 lines
458 B
Text
Raw Normal View History

#!/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 -- '->')
req_restart=""
echo "${updates}" | grep -qE "^($(get_grep)) " && req_restart=' <span color="#dd0000">(reboot)</span>'
printf "\uf94f %d %s%s" $num $(${HOME}/bin/pluralize Update $num) "${req_restart}"