Last active
August 29, 2015 14:05
-
-
Save ssokolow/80a1dd2743f53f80345f to your computer and use it in GitHub Desktop.
Simple GTK+ update notifier for apt-get which doesn't nag about restarting your PC
This file contains 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
# Add this to your USER (not root) crontab for daily update checks | |
0 6 * * * DISPLAY=:0 ~/bin/update_check.sh |
This file contains 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
# Add this to /etc/sudoers.d to allow updating without entering a password | |
Cmnd_Alias DISTUPGRADE = /usr/bin/apt-get dist-upgrade | |
ssokolow ALL = NOPASSWD: DISTUPGRADE | |
Defaults!DISTUPGRADE !requiretty |
This file contains 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/sh | |
# Simple replacement for the Ubuntu update notifier because I'm stubborn and | |
# refuse to bow to removal of configuration keys | |
# | |
# Copyright (C) 2014-2015 Stephan Sokolow (deitarion/SSokolow) | |
# | |
# License: MIT (http://opensource.org/licenses/MIT) | |
APT_COMMAND="/usr/bin/apt-get dist-upgrade" | |
ICON_PATH=~/.local/share/icons/elementary/apps/16/update-notifier.svg | |
# Used so this script can execute its second half within urxvt | |
if [ "$1" = "--run-apt" ]; then | |
# shellcheck disable=SC2086 | |
if ! sudo $APT_COMMAND; then | |
echo "Exited with non-success!" | |
read | |
fi | |
exit | |
fi | |
UPGRADES=$($APT_COMMAND -s -q -y --allow-unauthenticated | \ | |
/bin/grep '^Inst' | \ | |
/bin/sed 's@Inst \(\S*\) \(\[\(\S*\)\]\)\?[ ]\?(\(\S*\) .*@"\1" "\3" "\4"@g' | \ | |
/usr/bin/sort) | |
if [ -z "$UPGRADES" ]; then | |
exit | |
fi | |
if ! echo "$UPGRADES" | xargs zenity --list \ | |
--title="Updated packages available" \ | |
--window-icon="$ICON_PATH" \ | |
--text="The following packages have updates available:" \ | |
--column "Name" \ | |
--column "Current" \ | |
--column "Available" \ | |
--cancel-label="Remind Me Later" \ | |
--ok-label="Upgrade Now" >/dev/null; then | |
exit | |
fi | |
exec urxvt -e "$0" --run-apt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment