Skip to content
Snippets Groups Projects
Commit 82a87be2 authored by Ruben Rodriguez's avatar Ruben Rodriguez
Browse files

update-notifier: multiple upgrades to privacy and usability

parent b6021201
No related branches found
No related tags found
No related merge requests found
......@@ -52,7 +52,7 @@ def _get_output_from_lsb_release(lsb_option):
def get_distro():
" get distro name "
try:
return _get_info_from_os_release(key="UBUNTU_CODENAME")
return _get_info_from_os_release(key="RELEASE_CODENAME")
except Exception:
# If the system does not have os-release file or does not have the
# required entry in it, we will get the distro name from lsb_release
......@@ -101,7 +101,7 @@ def saveDistUpgrade(cache, depcache):
def isSecurityUpgrade(ver):
" check if the given version is a security update (or masks one) "
security_pockets = [("Ubuntu", "%s-security" % DISTRO),
("gNewSense", "%s-security" % DISTRO),
("Trisquel", "%s-security" % DISTRO),
("Debian", "%s-updates" % DISTRO)]
for (file, index) in ver.file_list:
for origin, archive in security_pockets:
......
diff -ru source.bak/data/backend_helper.py source/data/backend_helper.py
--- source.bak/data/backend_helper.py 2023-04-30 21:20:07.986410268 -0400
+++ source/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 source.orig/data/backend_helper.py source/data/backend_helper.py
--- source.orig/data/backend_helper.py 2023-05-01 10:18:12.941023681 -0400
+++ source/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 source.orig/src/update-notifier.c source/src/update-notifier.c
--- source.orig/src/update-notifier.c 2023-05-01 12:24:36.171054235 -0400
+++ source/src/update-notifier.c 2023-05-01 13:54:27.833304128 -0400
@@ -53,7 +53,7 @@
gboolean update_timer_finished(gpointer data);
// the time when we check for fam events, in seconds
-#define TIMEOUT_FAM 180
+#define TIMEOUT_FAM 30
// the timeout (in sec) when a further activity from dpkg/apt
// causes the applet to "ungray"
@@ -388,10 +388,9 @@
// monitor these dirs
static const char *monitor_dirs[] = {
- "/var/lib/apt/lists/", "/var/lib/apt/lists/partial/",
- "/var/cache/apt/archives/", "/var/cache/apt/archives/partial/",
+ "/var/lib/apt/lists/",
+ "/var/cache/apt/archives/",
HOOKS_DIR,
- CRASHREPORT_DIR,
NULL};
for(i=0;monitor_dirs[i] != NULL;i++) {
if (getenv("UPSTART_SESSION") && monitor_dirs[i] == CRASHREPORT_DIR) {
@@ -411,7 +410,6 @@
"/var/lib/dpkg/status",
"/var/lib/update-notifier/dpkg-run-stamp",
"/var/lib/apt/periodic/update-success-stamp",
- LIVEPATCH_FILE,
NULL};
for(i=0;monitor_files[i] != NULL;i++) {
GError *error = NULL;
diff -ru source.orig/src/update.c source/src/update.c
--- source.orig/src/update.c 2023-05-01 14:30:39.889778059 -0400
+++ source/src/update.c 2023-05-01 18:05:21.754318730 -0400
@@ -547,7 +547,7 @@
return;
}
- g_spawn_command_line_async("nice ionice -c3 update-manager "
+ g_spawn_command_line_async("sleep 5; nice ionice -c3 update-manager "
"--no-update --no-focus-on-map", NULL);
}
@@ -702,7 +702,8 @@
// show the notification with some delay. otherwise on a login
// the origin of the window is 0,0 and that looks ugly
- g_timeout_add_seconds(5, show_notification, ta);
+ if (priv->num_upgrades != 0)
+ g_timeout_add_seconds(5, show_notification, ta);
return TRUE;
}
diff -ru source.orig/src/update.c source/src/update.c
--- source.orig/src/update.c 2023-05-01 14:30:39.889778059 -0400
+++ source/src/update.c 2023-05-01 20:45:14.717390627 -0400
@@ -251,7 +251,7 @@
GTK_STOCK_DIALOG_INFO, 48,0,NULL);
notify_notification_set_icon_from_pixbuf (n, pix);
g_object_unref(pix);
- notify_notification_set_timeout (n, 60*1000);
+ notify_notification_set_timeout (n, 10*1000);
notify_notification_show(n, NULL);
// save the notification handle
if (priv->active_notification)
......@@ -18,11 +18,25 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
VERSION=9
VERSION=10
COMPONENT=main
. ./config
# Don't show the connection check screen when listing available updates
sed '/update-manager/s/--no-update/--no-update", "--no-check-screen/' -i data/backend_helper.py
# Actually install all upgrades in "Install all upgrades" menu entry
sed '/client.upgrade_system/s/safe_mode=True/safe_mode=False/' -i data/backend_helper.py
# Check updates with update-notifier instead of aptdaemon
patch -p1 < $DATA/check_updates_with_update_manager.patch
# Shorter check times for apt task ending
sed '/TIMEOUT_APT_RUN/s/600/60/g' -i src/update-notifier.c
# 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
# Reduce the timeout to refresh the status of the tray icon
patch -p1 < $DATA/improve_responsiveness.patch
#Use custom apt-check to fix motd update notification by striping esm stuff.
cp $DATA/apt_check.py data/apt_check.py
sed -i '/test_motd.py/d' debian/rules
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment