Categories
blogging code diy slackware

Check Slackware Changelog using conky

Yesterday I was wondering what’s the best way to update Slackware, and I decided to keep a local mirror of the current branch on my nas, I can mount the directory using the NFS protocol when I need it and the nas can go check for updates and fetch them during the night while I sleep and the network is idle.

The real problem is that I used to rely on Conky to check for updates to the current tree by issuing a slackpkg check-updates, but having slackpkg use my local mirror, it will always say that there are no updates, because the mirror is always updated. So I decided to bypass the mirror for the sole purpose of checking the changelog, and I came up with this script:

#!/bin/bash
 CL="https://sunsite.icm.edu.pl/pub/Linux/slackware/slackware64-current/ChangeLog.txt"
 LOCAL_CL="/var/lib/slackpkg/ChangeLog.txt"
 TMP="/tmp"
 TMPCL="${TMP}/ChangeLog.txt"
 if [[ -f ${TMPCL} ]]; then
     rm $TMPCL
 fi
     wget -q -P ${TMP} ${CL}
     if [ "$?" != 0 ]; then
         echo "Error checking updates…Wait until next try."
     fi
 NCL=$(head -n 1 ${TMPCL})
 LCL=$(head -n 1 ${LOCAL_CL})
 if [[ ${NCL} != ${LCL} ]];then
     echo "Updated packages available!"
 else
     echo "No news is good news!"
 fi

Now I just download the Changelog.txt file from a trusted mirror, using head I check for changes in the first line between the latest file stored by slackpkg and the one I downloaded and if I find a difference I output a line to conky.

This script is made to be run by Conky and usually I have it run once every 12 hours if my pc is on for that long.
I hope someone find it useful 😉

See you on the next one.