112 lines
3.6 KiB
Diff
112 lines
3.6 KiB
Diff
diff -ru a/data/backend_helper.py b/data/backend_helper.py
|
|
--- a/data/backend_helper.py 2023-04-30 21:20:07.986410268 -0400
|
|
+++ b/data/backend_helper.py 2023-04-30 21:35:59.442841302 -0400
|
|
@@ -58,35 +58,14 @@
|
|
return _install_all_updates_synaptic()
|
|
|
|
|
|
-# check updates
|
|
-def _check_updates_aptdaemon():
|
|
- from gi.repository import Gtk
|
|
- from aptdaemon import client, enums
|
|
- from aptdaemon.gtk3widgets import AptProgressDialog
|
|
- client = client.AptClient()
|
|
- trans = client.update_cache()
|
|
- dia = AptProgressDialog(trans)
|
|
- dia.connect("finished", Gtk.main_quit)
|
|
- dia.run()
|
|
- Gtk.main()
|
|
- return trans.exit == enums.EXIT_SUCCESS
|
|
-
|
|
-
|
|
-def _check_updates_gtk():
|
|
- cmd = ["/usr/bin/synaptic-pkexec",
|
|
- "--update-at-startup",
|
|
- "--non-interactive",
|
|
- "--hide-main-window",
|
|
- ]
|
|
- subprocess.call(cmd)
|
|
-
|
|
-
|
|
def check_updates():
|
|
- """ check for updates either with aptdaemon or synaptic """
|
|
- if HAVE_APTDAEMON:
|
|
- return _check_updates_aptdaemon()
|
|
+ """ check and show updates using update-manager """
|
|
+ if os.path.exists("/usr/bin/update-manager"):
|
|
+ cmd = ["update-manager", "--no-check-screen"]
|
|
+ res = subprocess.call(cmd)
|
|
+ return (res == 0)
|
|
else:
|
|
- return _check_updates_gtk()
|
|
+ logging.error("update-manager is not installed")
|
|
|
|
|
|
# start packagemanager
|
|
diff -ru a/data/backend_helper.py b/data/backend_helper.py
|
|
--- a/data/backend_helper.py 2023-05-01 10:18:12.941023681 -0400
|
|
+++ b/data/backend_helper.py 2023-05-01 10:27:12.724396819 -0400
|
|
@@ -53,9 +53,10 @@
|
|
def install_all_updates():
|
|
""" install all updates either with synaptic or aptdaemon """
|
|
if HAVE_APTDAEMON:
|
|
- return _install_all_updates_aptdaemon()
|
|
+ _install_all_updates_aptdaemon()
|
|
else:
|
|
- return _install_all_updates_synaptic()
|
|
+ _install_all_updates_synaptic()
|
|
+ return show_updates()
|
|
|
|
|
|
def check_updates():
|
|
diff -ru a/data/backend_helper.py b/data/backend_helper.py
|
|
--- a/data/backend_helper.py 2023-05-04 20:33:23.000867005 -0400
|
|
+++ b/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]
|