Yet Another Simple Update Notifier

If you’re using a debian-based distro (such as Ubuntu or Linux Mint; both of which I view as Linux for Apple for Microsoft GUI babies either too lazy or afraid to use a terminal) or some derivative of RedHat (such as Fedora or CentOS) you may or may not have a systray applet that lets you know package updates are available. Below is a simple script, for debian-based installations, that will do just that.

The utility, chreli-update-check, written in Perl, leverages aptitude and yad (yet another dialog).

The aptitude command is as follows:

/usr/bin/aptitude search "~U" | /usr/bin/wc -l

The above instructs aptitude to search for upgradable packages (~U is shorthand) and is piped to the wc -l command to get the number of lines returned. You can read more about aptitude search terms here.

If you want to see what’s available to be updated, simply remove the | /usr/bin/wc -l from the above command:

/usr/bin/aptitude search "~U" 
i A libmenu-cache-bin    - LXDE implementation of the freedesktop Menu's cache (libexec)              
i A libmenu-cache3       - LXDE implementation of the freedesktop Menu's cache                        
i   pcmanfm              - extremely fast and lightweight file manager

If chreli-update-check detects updates (greater than 0 [zero]), it will construct the yad command to either display an in-your-face dialog: or a more subtle systray icon (displays details when moused over): The determination of either behavior is controlled by the chreli-update-check.nofification setting in ~/.config/chreli-update-check/chreli-update-check.conf; default is dialog.

To install chreli-update-check simply download chreli-update-check_1.0.20170520.deb and execute the following:

Disclaimer: This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

sudo /usr/bin/dpkg -i chreli-update-check_1.0.20170520.deb

Once installed, simply execute:


To schedule its execution, add the following to your crontab:

15 */4 * * * DISPLAY=:0 /usr/bin/chreli-update-check > /dev/null 2>&1

The above will execute 15 minutes past, every 4 hours; you can adjust as you deem necessary.

The initial time chreli-update-check executes, it will create a chreli-update-check.conf in ~/.config/chreli-update-check with default settings for which icon to use (chreli-update-check.icon) and what type of notification (chreli-update-check.nofification):

# chreli-update-check 1.0.20170520
# configuration file for chreli-update-check

# icon to use for dialog or systray
# default: /usr/share/icons/Adwaita/16x16/apps/system-software-update.png

# type of notification
# legal values:
#  o systray: displays icon in systray
#  o dialog : displays dialog
# default: dialog

Adjust to your needs.

And that’s all I have to say about that.

This entry was posted in Geek, Linux, PERL, Scripting and tagged , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply