2018-12-03 08:41:12 +00:00
|
|
|
#!/bin/bash
|
2018-12-03 14:22:12 +00:00
|
|
|
set -euo pipefail
|
2018-12-03 08:41:12 +00:00
|
|
|
|
2018-12-05 11:17:45 +00:00
|
|
|
req_restart_prefix=(
|
|
|
|
linux
|
|
|
|
systemd
|
|
|
|
)
|
2018-12-03 08:41:12 +00:00
|
|
|
|
2018-12-05 11:17:45 +00:00
|
|
|
function get_grep() {
|
|
|
|
local IFS_bak="${IFS}"
|
|
|
|
IFS="|"
|
|
|
|
echo "${req_restart_prefix[*]}"
|
|
|
|
IFS="${IFS_bak}"
|
|
|
|
}
|
|
|
|
|
|
|
|
updates=$(checkupdates)
|
|
|
|
|
2018-12-05 21:46:22 +00:00
|
|
|
num=$(echo -n "${updates}" | wc -l)
|
2018-12-05 11:17:45 +00:00
|
|
|
[ $num -gt 0 ] || exit
|
|
|
|
|
|
|
|
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}"
|