Created
September 13, 2014 10:43
-
-
Save Yoplitein/98eddf7e9f1f74e61b29 to your computer and use it in GitHub Desktop.
Simple script to alert you, via email (through cron,) of packages with upgrades on Arch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cacheFile=~/bin/updates.cache | |
cacheFileNew=~/bin/updates-new.cache | |
function getignores() | |
{ | |
#list ignored packages here, like so: | |
#echo "packagename" | |
#TODO: actually parse pacman.conf | |
} | |
function getupdates() | |
{ | |
res="$(checkupdates)" | |
for ignore in $(getignores); do | |
res="$(echo "$res" | grep -v "^$ignore$")" | |
done | |
for package in $res; do | |
echo $package | |
done | |
} | |
function getdiff() | |
{ | |
echo "$(diff $cacheFile $cacheFileNew | grep "^>" | cut -d " " -f 2)" | |
} | |
function main() | |
{ | |
echo "$(getupdates)" > $cacheFileNew | |
diff="$(getdiff)" | |
if [ "$diff" != "" ]; then | |
echo "The following packages are ready for upgrade:" | |
echo "$diff" | |
echo "$(cat $cacheFileNew)" > $cacheFile | |
fi | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment