update-notifier: improved regular reminder management

This commit is contained in:
Ruben Rodriguez 2023-05-04 22:11:29 -04:00
parent f83900433f
commit 09aa87718e
2 changed files with 57 additions and 3 deletions

View file

@ -59,3 +59,54 @@ diff -ru source.orig/data/backend_helper.py source/data/backend_helper.py
def check_updates(): def check_updates():
diff -ru source.orig/data/backend_helper.py source/data/backend_helper.py
--- source.orig/data/backend_helper.py 2023-05-04 20:33:23.000867005 -0400
+++ source/data/backend_helper.py 2023-05-04 20:37:57.616904543 -0400
@@ -5,6 +5,7 @@
import os
import subprocess
import sys
+import apt_pkg
HAVE_APTDAEMON = False
try:
@@ -69,6 +70,16 @@
logging.error("update-manager is not installed")
+def reminder_check():
+ """ check and show updates using update-manager """
+ if os.path.exists("/usr/bin/update-manager"):
+ cmd = ["update-manager", "--check-dist-upgrades", "--no-focus-on-map"]
+ res = subprocess.call(cmd)
+ return (res == 0)
+ else:
+ logging.error("update-manager is not installed")
+
+
# start packagemanager
def start_packagemanager():
if os.path.exists("/usr/bin/synaptic-pkexec"):
@@ -127,6 +138,9 @@
# check_updates - synaptic --reload/aptdaemon reload
command = subparser.add_parser("check_updates")
command.set_defaults(command="check_updates")
+ # reminder_check
+ command = subparser.add_parser("reminder_check")
+ command.set_defaults(command="reminder_check")
# start_pkgmanager
command = subparser.add_parser("start_packagemanager")
command.set_defaults(command="start_packagemanager")
@@ -141,6 +155,12 @@
else:
logging.basicConfig(level=logging.INFO)
+ # we show a "do you want to check for updates" every 2 weeks, if auto-update is off
+ if args.command == "reminder_check":
+ apt_pkg.init()
+ if apt_pkg.config.find_i("APT::Periodic::Update-Package-Lists") != 0:
+ sys.exit(0)
+
func_name = args.command
f_kwargs = {}
f = globals()[func_name]

View file

@ -18,7 +18,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
VERSION=11 VERSION=12
COMPONENT=main COMPONENT=main
. ./config . ./config
@ -31,8 +31,8 @@ sed '/client.upgrade_system/s/safe_mode=True/safe_mode=False/' -i data/backend_h
patch -p1 < $DATA/check_updates_with_update_manager.patch patch -p1 < $DATA/check_updates_with_update_manager.patch
# Shorter check times for apt task ending # Shorter check times for apt task ending
sed '/TIMEOUT_APT_RUN/s/600/60/g' -i src/update-notifier.c sed '/TIMEOUT_APT_RUN/s/600/60/g' -i src/update-notifier.c
# Use update-manager to checks for dist-upgrades # Use update-manager to checks for dist-upgrades.
sed '/RELEASE_UPGRADE_CHECKER/s|/usr/lib/ubuntu-release-upgrader/check-new-release-gtk|sleep 5; nice ionice -c3 /usr/bin/update-manager --check-dist-upgrades --no-update --no-focus-on-map|' -i src/update-notifier.h sed '/RELEASE_UPGRADE_CHECKER/s|/usr/lib/ubuntu-release-upgrader/check-new-release-gtk|sleep 5; nice ionice -c3 /usr/lib/update-notifier/backend_helper.py reminder_check|' -i src/update-notifier.h
# Reduce the timeout to refresh the status of the tray icon # Reduce the timeout to refresh the status of the tray icon
patch -p1 < $DATA/improve_responsiveness.patch patch -p1 < $DATA/improve_responsiveness.patch
@ -139,6 +139,9 @@ EOF
sed -i '/Description: Daemon/i Breaks: update-notifier-common (<= 3.192.54.6+11.0trisquel8)' debian/control sed -i '/Description: Daemon/i Breaks: update-notifier-common (<= 3.192.54.6+11.0trisquel8)' debian/control
sed -i '/Suggests: policykit-1/i Breaks: update-notifier-common (<= 3.192.54.6+11.0trisquel8)' debian/control sed -i '/Suggests: policykit-1/i Breaks: update-notifier-common (<= 3.192.54.6+11.0trisquel8)' debian/control
# Improve gtk dependency
sed '/Package: update-notifier$/,/^$/s/policykit-1/policykit-1, python3-aptdaemon.gtk3widgets/' -i debian/control
changelog "Disabled hp-firmware handling and ubuntu-drivers" changelog "Disabled hp-firmware handling and ubuntu-drivers"
compile compile