aboutsummaryrefslogtreecommitdiff
path: root/.config/yambar/scripts/chimera-updates.sh
blob: 1cbc05d5d186f8f5eb041b122fe6606742ef4805 (plain) (blame)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash

function update-yambar {
echo "updates|string|"
echo ""

while true; do

doas apk update &>/dev/null
updates="$(apk -u list | awk '{ print $1 }')"
number="$(apk -u list | wc -l | awk '{$1=$1};1')"

if [ "$number" -gt 0 ]; then
    text=" $number"
else
    text=""
fi

echo "updates|string|$text"
echo ""
sleep 30m

done
}

function update {
	foot bash -c "doas apk upgrade"; sh -c "~/.config/yambar/scripts/yambar-start.sh"
}

case $1 in
	update)
		update
		;;
	*)
		update-yambar
		;;
esac
exit 0