diff --git a/etc/sudoers.d/mintupdate b/etc/sudoers.d/mintupdate new file mode 100644 index 00000000..24196f47 --- /dev/null +++ b/etc/sudoers.d/mintupdate @@ -0,0 +1,6 @@ +# Allow any user to check for new system updates without +# requiring user authentication. + +Cmnd_Alias UPDATE = /usr/lib/linuxmint/mintUpdate/checkAPT.py + +ALL ALL = NOPASSWD:UPDATE diff --git a/usr/lib/linuxmint/mintUpdate/checkAPT.py b/usr/lib/linuxmint/mintUpdate/checkAPT.py index 87ba2609..c9651ff7 100755 --- a/usr/lib/linuxmint/mintUpdate/checkAPT.py +++ b/usr/lib/linuxmint/mintUpdate/checkAPT.py @@ -26,7 +26,7 @@ # return changes try: - cache = None + cache = apt.Cache() if os.getuid() == 0 : use_synaptic = False @@ -44,7 +44,6 @@ returnCode = comnd.wait() #sts = os.waitpid(comnd.pid, 0) else: - cache = apt.Cache() cache.update() sys.path.append('/usr/lib/linuxmint/common') @@ -58,8 +57,8 @@ except: dist_upgrade = True - if cache is None: - cache = apt.Cache() + # Reopen the cache to reflect any updates + cache.open(None) cache.upgrade(dist_upgrade) changes = cache.get_changes() diff --git a/usr/lib/linuxmint/mintUpdate/mintUpdate.py b/usr/lib/linuxmint/mintUpdate/mintUpdate.py index 1badcbd8..5071aba1 100755 --- a/usr/lib/linuxmint/mintUpdate/mintUpdate.py +++ b/usr/lib/linuxmint/mintUpdate/mintUpdate.py @@ -463,9 +463,9 @@ def run(self): wTree.get_widget("vpaned1").set_position(vpaned_position) gtk.gdk.threads_leave() if app_hidden: - updates = commands.getoutput("/usr/lib/linuxmint/mintUpdate/checkAPT.py | grep \"###\"") + updates = commands.getoutput("sudo /usr/lib/linuxmint/mintUpdate/checkAPT.py | grep \"###\"") else: - updates = commands.getoutput("/usr/lib/linuxmint/mintUpdate/checkAPT.py --use-synaptic %s | grep \"###\"" % self.wTree.get_widget("window1").window.xid) + updates = commands.getoutput("sudo /usr/lib/linuxmint/mintUpdate/checkAPT.py --use-synaptic %s | grep \"###\"" % self.wTree.get_widget("window1").window.xid) # Look for mintupdate if ("UPDATE###mintupdate###" in updates):