summaryrefslogtreecommitdiffstats
path: root/update_checker.sh
blob: 5b0415657a15862fe2b5510f73df7956be6b5f16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
#----------------------------------------------------
# Version:      0.1.1.1
# Author:       Florian "Bluewind" Pritz <f-p@gmx.at>
#
# Licensed under WTFPL v2
#   (see COPYING for full license text)
#
#----------------------------------------------------
# Shows if package updates are available
#----------------------------------------------------
export LC_ALL=C
cmd="pacman -Qu"
pac_num=$($cmd | grep -o "Targets ([0-9]*)" | sed 's/Targets (//; s/)//')
#$cmd | grep "Total Download Size: .*MB" | grep -o "[0-9].*"

if [ ! $pac_num ]; then
  pac_num=0
fi

if [ $pac_num -gt 0 ]; then
  echo "${HOSTNAME}: $pac_num"
else
  echo "${HOSTNAME}: ok"
fi