2017-09-29 15:32:38 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
2016-04-01 17:04:44 +00:00
|
|
|
|
2018-03-29 10:22:23 +00:00
|
|
|
for p in trizen pacaur yaourt pacman; do
|
2017-09-29 15:32:38 +00:00
|
|
|
if $p --version &>/dev/null; then
|
|
|
|
PAC="$p"
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
2016-04-01 17:04:44 +00:00
|
|
|
|
2017-09-29 15:32:38 +00:00
|
|
|
if [ -z "$PAC" ]; then
|
|
|
|
>&2 echo "Error: No Arch package manager found?"
|
|
|
|
fi
|
2016-04-01 17:04:44 +00:00
|
|
|
|
2017-09-29 15:32:38 +00:00
|
|
|
if [ "$BLOCK_BUTTON" == 1 ]; then
|
2018-03-29 10:22:23 +00:00
|
|
|
nohup i3-sensible-terminal -r i3blocks-update-term -e "sh -c '$PAC -Syu || exec zsh; pkill -RTMIN+5 i3blocks'" &>/dev/null &
|
2017-09-29 15:32:38 +00:00
|
|
|
disown
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $p = "pacman" ]; then
|
|
|
|
exec 3< <(checkupdates)
|
|
|
|
else
|
|
|
|
exec 3< <({ checkupdates & cower -u & })
|
|
|
|
fi
|
|
|
|
|
|
|
|
count="$(wc -l <&3)"
|
|
|
|
|
|
|
|
if [ -n "$count" -a "$count" -gt 0 ]; then
|
|
|
|
echo $count
|
|
|
|
echo $count
|
|
|
|
fi
|