dotfiles/i3/scripts/slack_updates

29 lines
1009 B
Bash
Executable File

#!/bin/bash
update="$(/usr/sbin/slackpkg check-updates)"
update="$(echo $update | grep 'No news is good news')"
version="$(cat /etc/slackware-version | cut -d' ' -f2)"
arch="$(uname -m)"
mirror="https://freeslack.net/fxp/freeslack64-14.2/"
wget -q -O - $mirror/ChangeLog.txt | iconv -f ISO-8859-1 -t UTF-8 > /tmp/changelog.txt
end="$(grep -n '+--------------------------+' /tmp/changelog.txt | head -n1 | cut -d':' -f1)"
changelog="$(head -n$end /tmp/changelog.txt | grep txz | cut -d'/' -f3 | cut -d':' -f1 | sed "s/-[0-9].*//")"
num_changelog="$(head -n$end /tmp/changelog.txt | grep txz | cut -d'/' -f2 | cut -d':' -f1 | wc -l)"
case $BLOCK_BUTTON in
1) notify-send -u low "`echo "$changelog"`" ;;
3) notify-send -u low "`echo "$changelog"`" ;;
esac
if [ -z "$update" ]
then
echo -n "<span foreground='black' background='#4c83ff'> &#xf021; `echo $num_changelog` Updates </span>"
else
echo -n "<span foreground='black' background='#4c83ff'> &#xf021; No Updates </span>"
fi
exit 0