r14646 - in /packages/unstable/update-notifier/debian: 15update-stamp changelog changelog.ubuntu patches/04_fix_gksu_usage.diff

alanbach-guest at users.alioth.debian.org alanbach-guest at users.alioth.debian.org
Mon Feb 18 10:25:16 UTC 2008


Author: alanbach-guest
Date: Mon Feb 18 10:25:16 2008
New Revision: 14646

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=14646
Log:
* Merged new upstream (0.70.4) changes
* Refreshed 04_fix_gksu_usage.diff to be applied correctly

Modified:
    packages/unstable/update-notifier/debian/15update-stamp
    packages/unstable/update-notifier/debian/changelog
    packages/unstable/update-notifier/debian/changelog.ubuntu
    packages/unstable/update-notifier/debian/patches/04_fix_gksu_usage.diff

Modified: packages/unstable/update-notifier/debian/15update-stamp
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/update-notifier/debian/15update-stamp?rev=14646&op=diff
==============================================================================
--- packages/unstable/update-notifier/debian/15update-stamp (original)
+++ packages/unstable/update-notifier/debian/15update-stamp Mon Feb 18 10:25:16 2008
@@ -1,1 +1,1 @@
-APT::Update::Post-Invoke:: {"touch /var/lib/apt/periodic/update-stamp 2>/dev/null || true";};
+APT::Update::Post-Invoke-Success:: {"touch /var/lib/apt/periodic/update-success-stamp 2>/dev/null || true";};

Modified: packages/unstable/update-notifier/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/update-notifier/debian/changelog?rev=14646&op=diff
==============================================================================
--- packages/unstable/update-notifier/debian/changelog (original)
+++ packages/unstable/update-notifier/debian/changelog Mon Feb 18 10:25:16 2008
@@ -1,7 +1,7 @@
-update-notifier (0.70.3.debian-1) unstable; urgency=low
+update-notifier (0.70.4.debian-1) unstable; urgency=low
 
   [ Alan Baghumian ]
-  * New upstream stable release
+  * New upstream stable releases
   * debian/changelog.ubuntu:
     - updated from the Ubuntu package
   * debian/control*:
@@ -21,6 +21,7 @@
     - extra space clean-ups
   * Updated 04_fix_gksu_usage.diff:
     - call update-manager with gksu
+    - refreshed to be applied correctly
   * Rename upgrade-notifier.cron.daily to update-notifier.cron.daily
     as mentioned in the manpage
   * Removed debian/install: obsolete, merged with
@@ -30,7 +31,7 @@
   * debian/control:
   - Make GNOME team the maintainer, I can no longer be involved
 
- -- Alan Baghumian <alan at technotux.org>  Tue, 05 Feb 2008 10:56:28 +0330
+ -- Alan Baghumian <alan at technotux.org>  Mon, 18 Feb 2008 13:52:54 +0330
 
 update-notifier (0.59.5.debian-1) unstable; urgency=low
 

Modified: packages/unstable/update-notifier/debian/changelog.ubuntu
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/update-notifier/debian/changelog.ubuntu?rev=14646&op=diff
==============================================================================
--- packages/unstable/update-notifier/debian/changelog.ubuntu (original)
+++ packages/unstable/update-notifier/debian/changelog.ubuntu Mon Feb 18 10:25:16 2008
@@ -1,3 +1,11 @@
+update-notifier (0.70.4) hardy; urgency=low
+
+  * src/update.c, debian/15update-stamp:
+    - run in the new APT::Update::Post-Invoke-Success slot
+    - use /var/lib/apt/periodic/update-success-stamp stamp
+
+ -- Michael Vogt <michael.vogt at ubuntu.com>  Wed, 06 Feb 2008 19:16:58 +0100
+
 update-notifier (0.70.3) hardy; urgency=low
 
   * src/update.c:

Modified: packages/unstable/update-notifier/debian/patches/04_fix_gksu_usage.diff
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/update-notifier/debian/patches/04_fix_gksu_usage.diff?rev=14646&op=diff
==============================================================================
--- packages/unstable/update-notifier/debian/patches/04_fix_gksu_usage.diff (original)
+++ packages/unstable/update-notifier/debian/patches/04_fix_gksu_usage.diff Mon Feb 18 10:25:16 2008
@@ -1,10 +1,10 @@
-diff -urN update-notifier-0.57.3.old/src/update.c update-notifier-0.57.3/src/update.c
---- update-notifier-0.57.3.old/src/update.c	2007-06-26 08:00:12.000000000 -0300
-+++ update-notifier-0.57.3/src/update.c	2007-06-30 13:11:43.000000000 -0300
-@@ -13,8 +13,8 @@
+diff -urpN update-notifier-0.70.4.debian/src/update.c update-notifier-0.70.4.debian.new/src/update.c
+--- update-notifier-0.70.4.debian/src/update.c	2008-02-02 00:38:39.000000000 +0330
++++ update-notifier-0.70.4.debian.new/src/update.c	2008-02-07 16:28:17.000000000 +0330
+@@ -17,8 +17,8 @@
  
  // command, description, desktopfile, needs_gksu
- char* actions[][4] = {
+ const char* actions[][4] = {
 -   { "/usr/bin/update-manager", N_("Show updates"), 
 -     "/usr/share/applications/update-manager.desktop", FALSE },
 +   { "gksu update-manager", N_("Show updates"), 
@@ -12,7 +12,7 @@
  
     { "/usr/sbin/synaptic --dist-upgrade-mode --non-interactive --hide-main-window -o Synaptic::AskRelated=true",
       N_("Install all updates"), "/usr/share/applications/synaptic.desktop", TRUE
-@@ -146,7 +146,7 @@
+@@ -86,7 +86,7 @@ cb_action(GObject *self, void *user_data
  void 
  cb_preferences(GObject *self, void *user_data)
  {
@@ -21,10 +21,10 @@
  		    "/usr/share/applications/software-properties.desktop",
  		    FALSE);    
  }
-diff -urN update-notifier-0.57.3.old/src/update-notifier.c update-notifier-0.57.3/src/update-notifier.c
---- update-notifier-0.57.3.old/src/update-notifier.c	2007-06-26 08:00:12.000000000 -0300
-+++ update-notifier-0.57.3/src/update-notifier.c	2007-06-30 13:11:11.000000000 -0300
-@@ -70,12 +70,13 @@
+diff -urpN update-notifier-0.70.4.debian/src/update-notifier.c update-notifier-0.70.4.debian.new/src/update-notifier.c
+--- update-notifier-0.70.4.debian/src/update-notifier.c	2008-02-01 19:17:47.000000000 +0330
++++ update-notifier-0.70.4.debian.new/src/update-notifier.c	2008-02-07 16:29:33.000000000 +0330
+@@ -73,12 +73,13 @@ void
  invoke_with_gksu(gchar *cmd, gchar *descr, gboolean whole_message)
  {
          //g_print("invoke_update_manager ()\n");
@@ -41,3 +41,468 @@
  
  	g_spawn_async (NULL, argv, NULL, 0, NULL, NULL, NULL, NULL);
  }
+diff -urpN update-notifier-0.70.4.debian/src/update-notifier.c.orig update-notifier-0.70.4.debian.new/src/update-notifier.c.orig
+--- update-notifier-0.70.4.debian/src/update-notifier.c.orig	1970-01-01 03:30:00.000000000 +0330
++++ update-notifier-0.70.4.debian.new/src/update-notifier.c.orig	2008-02-01 19:17:47.000000000 +0330
+@@ -0,0 +1,461 @@
++/* update-notifier.c
++ * Copyright (C) 2004 Lukas Lipka <lukas at pmad.net>
++ *           (C) 2004 Michael Vogt <mvo at debian.org>
++ *           (C) 2004 Michiel Sikkes <michiel at eyesopened.nl>
++ *           (C) 2004-2006 Canonical
++ *
++ * This library is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU Lesser General Public
++ * License as published by the Free Software Foundation; either
++ * version 2 of the License, or (at your option) any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public
++ * License along with this library; if not, write to the
++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ * Boston, MA 02111-1307, USA.
++ */
++
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
++
++#include <signal.h>
++#include <gnome.h>
++#include <grp.h>
++#include <pwd.h>
++#include <limits.h>
++#include <glib.h>
++#include <glib/gstdio.h>
++#include <gtk/gtk.h>
++#include <glade/glade.h>
++#include <libgnomevfs/gnome-vfs.h>
++#include <libgnomevfs/gnome-vfs-utils.h>
++#include <libgnomevfs/gnome-vfs-monitor.h>
++
++#include "update-notifier.h"
++#include "hal.h"
++#include "update.h"
++#include "hooks.h"
++#include "reboot.h"
++#include "crash.h"
++#include "avahi.h"
++
++/* some prototypes */
++extern gboolean up_get_clipboard (void);
++gboolean update_timer_finished(gpointer data);
++
++// the time when we check for fam events
++#define TIMEOUT_FAM 1000*5 /* 5 sec */
++
++// the timeout (in msec) for apt-get update (changes in 
++// /var/lib/apt/lists{/partial})
++#define TIMEOUT_APT_GET_UPDATE 1000*30 /* 30 sec */
++
++// the timeout (in sec) when a further activity from dpkg/apt
++// causes the applet to "ungray"
++#define TIMEOUT_APT_RUN 120 /* 120 sec */
++
++
++void invoke(gchar *cmd, gchar *desktop, gboolean with_gksu)
++{
++   if(with_gksu)
++      invoke_with_gksu(cmd, desktop, FALSE);
++   else
++      g_spawn_command_line_async(cmd, NULL);
++}
++
++void
++invoke_with_gksu(gchar *cmd, gchar *descr, gboolean whole_message)
++{
++        //g_print("invoke_update_manager ()\n");
++	gchar *argv[5];
++	argv[0] = "/usr/bin/gksu";
++	argv[1] = whole_message ? "--message" : "--desktop";
++	argv[2] = descr;
++	argv[3] = cmd;
++	argv[4] = NULL;
++
++	g_spawn_async (NULL, argv, NULL, 0, NULL, NULL, NULL, NULL);
++}
++
++
++
++gboolean
++trayapplet_create (TrayApplet *un, char *name)
++{
++        //g_print("trayicon_create()\n");
++
++	/* setup widgets */
++	un->tray_icon = gtk_status_icon_new_from_icon_name (name);
++	un->name = name;
++	gtk_status_icon_set_visible (un->tray_icon, FALSE);
++
++	return TRUE;
++}
++
++
++/* 
++ the following files change:
++ on "install":
++  - /var/lib/dpkg/lock
++  - /var/lib/dpkg/ *
++  - /var/lib/update-notifier/dpkg-run-stamp
++ on "update":
++  - /var/lib/apt/lists/lock
++  - /var/lib/apt/lists/ *
++  - /var/lib/dpkg/lock
++*/
++void
++monitor_cb(GnomeVFSMonitorHandle *handle,
++	   const gchar *monitor_uri,
++	   const gchar *info_uri,
++	   GnomeVFSMonitorEventType event_type,
++	   gpointer user_data)
++{
++   UpgradeNotifier *un = (UpgradeNotifier*)user_data;
++
++#if 0
++   g_print("monitor_uri: %s\n", monitor_uri);
++   g_print("info_uri: %s\n", info_uri);
++   g_print("event_type: %i\n",event_type);
++#endif
++
++   // we ignore lock file events because we can only get 
++   // when a lock was taken, but not when it was removed
++   if(g_str_has_suffix(info_uri, "lock"))
++      return;
++
++   // look for apt-get install/update
++   if(g_str_has_prefix(info_uri,"file:///var/lib/apt/") 
++      || g_str_has_prefix(info_uri,"file:///var/cache/apt/")
++      || strcmp(info_uri,"file:///var/lib/dpkg/status") == 0) {
++      un->apt_get_runing=TRUE;
++   } 
++   if(strstr(info_uri, "/var/lib/update-notifier/dpkg-run-stamp")) {
++      un->dpkg_was_run = TRUE;
++   } 
++   if(strstr(info_uri, REBOOT_FILE)) {
++      //g_print("reboot required\n");
++      un->reboot_pending = TRUE;
++   }
++   if(strstr(info_uri, HOOKS_DIR)) {
++      //g_print("new hook!\n");
++      un->hook_pending = TRUE;
++   }
++   if(strstr(info_uri, CRASHREPORT_DIR)) {
++      //g_print("crashreport found\n");
++      un->crashreport_pending = TRUE;
++   }
++   if(strstr(info_uri, UNICAST_LOCAL_AVAHI_FILE)) {
++      //g_print("avahi disabled due to unicast .local domain\n");
++      un->unicast_local_avahi_pending = TRUE;
++   }
++}
++
++/*
++ * We periodically check here what actions happend in this "time-slice". 
++ * This can be:
++ * - dpkg_was_run=TRUE: set when apt wrote the "dpkg-run-stamp" file
++ * - apt_get_runing: set when apt/dpkg activity is detected (in the 
++ *                   lists-dir, archive-cache, or /var/lib/dpkg/status
++ * - hook_pending: we have new upgrade hoook information
++ * - reboot_pending: we need to reboot
++ * - crashreport_pending: we have a new crashreport
++ * - unicast_local_avahi_pending: avahi got disabled due to a unicast .local domain
++ *
++ */
++gboolean file_monitor_periodic_check(gpointer data)
++
++{
++   UpgradeNotifier *un = (UpgradeNotifier *)data;
++
++   // we are not ready yet, wait for the next timeslice
++   if((un->update == NULL) || (un->reboot == NULL) || (un->crashreport == NULL))
++      return TRUE;
++
++   // DPkg::Post-Invoke has written a stamp file, that means a install/remove
++   // operation finished, we can show hooks/reboot notifications then
++   if(un->dpkg_was_run) {
++
++      // check updates
++      update_check(un->update);
++
++      // any apt-get update  must be finished, otherwise 
++      // apt-get install wouldn't be finished
++      update_apt_is_running(un->update, FALSE);
++      if(un->update_finished_timer > 0) 
++	 g_source_remove(un->update_finished_timer);
++      
++      // show pending hooks/reboots
++      if(un->hook_pending) {
++	 //g_print("checking hooks now\n");
++	 check_update_hooks(un->hook);
++	 un->hook_pending = FALSE;
++      }
++      if(un->reboot_pending) {
++	 //g_print("checking reboot now\n");
++	 reboot_check (un->reboot);
++	 un->reboot_pending = FALSE;
++      }
++
++      // apt must be finished when a new stamp file was writen, so we
++      // reset the apt_get_runing time-slice field because its not 
++      // important anymore (it finished runing)
++      //
++      // This may leave a 5s race condition when a apt-get install finished
++      // and something new (apt-get) was started
++      un->apt_get_runing = FALSE;
++      un->last_apt_action = 0;
++   }
++
++   // apt-get update/install or dpkg is runing (and updates files in 
++   // it's list/cache dir) or in /var/lib/dpkg/status
++   if(un->apt_get_runing) 
++      update_apt_is_running(un->update, TRUE);
++
++   // update time information for apt/dpkg
++   time_t now = time(NULL);
++   if(un->apt_get_runing) 
++      un->last_apt_action = now;
++
++   // no apt operation for a long time
++   if(un->last_apt_action > 0 &&
++      (now - un->last_apt_action) >  TIMEOUT_APT_RUN) {
++      update_apt_is_running(un->update, FALSE);
++      update_check(un->update);
++      un->last_apt_action = 0;
++   }
++
++   if(un->crashreport_pending) {
++      g_print("checking for valid crashreport now\n");
++      crashreport_check (un->crashreport);
++      un->crashreport_pending = FALSE;
++   }
++
++   if(un->unicast_local_avahi_pending) {
++      g_print("checking for disabled avahi due to unicast .local domain now\n");
++      avahi_disabled_check ();
++      un->unicast_local_avahi_pending = FALSE;
++   }
++
++   // reset the bitfields (for the next "time-slice")
++   un->dpkg_was_run = FALSE;
++   un->apt_get_runing = FALSE;
++
++   return TRUE;
++}
++
++
++
++
++/* u_abort seems like an internal error notification.
++ * End user might not understand the message at all */
++void u_abort(gchar *msg)
++{
++   msg = g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s\n", _("Internal error"), msg);
++   gtk_dialog_run(GTK_DIALOG(gtk_message_dialog_new_with_markup(NULL,0,
++						     GTK_MESSAGE_ERROR,
++						     GTK_BUTTONS_CLOSE,
++						     msg)));
++   g_free(msg);
++   exit(1);
++}
++
++// FIXME: get the apt directories with apt-config or something
++gboolean monitor_init(UpgradeNotifier *un)
++{
++   int i;
++   GnomeVFSResult res;
++   GnomeVFSMonitorHandle *monitor_handle;
++
++   // monitor thise dirs
++   static const char *monitor_dirs[] = { 
++      "/var/lib/apt/lists/", "/var/lib/apt/list/partial", 
++      "/var/cache/apt/archives/", "/var/cache/apt/archives/partial", 
++      HOOKS_DIR, 
++      CRASHREPORT_DIR,
++      NULL};
++   for(i=0;monitor_dirs[i] != NULL;i++) {
++      res = gnome_vfs_monitor_add(&monitor_handle,
++				  monitor_dirs[i],
++				  GNOME_VFS_MONITOR_DIRECTORY,
++				  monitor_cb, un);
++   }
++
++   // and those files
++   static const char *monitor_files[] = { 
++      "/var/lib/dpkg/status", 
++      "/var/lib/update-notifier/dpkg-run-stamp", 
++      REBOOT_FILE,
++      UNICAST_LOCAL_AVAHI_FILE,
++      NULL};
++   for(i=0;monitor_files[i] != NULL;i++) {
++      res = gnome_vfs_monitor_add(&monitor_handle,
++				  monitor_files[i],
++				  GNOME_VFS_MONITOR_FILE,
++				  monitor_cb, un);
++   }
++
++   g_timeout_add (TIMEOUT_FAM, (GSourceFunc)file_monitor_periodic_check, un);
++
++
++   return TRUE;
++}
++
++
++
++
++static gboolean
++tray_icons_init(UpgradeNotifier *un)
++{
++   //g_debug("tray_icons_init");
++
++   /* new upates tray icon */
++   un->update = g_new0 (TrayApplet, 1);
++
++   trayapplet_create(un->update, "software-update-available");
++   update_tray_icon_init(un->update);
++
++   /* update hook icon*/
++   un->hook = g_new0 (TrayApplet, 1);
++   trayapplet_create(un->hook, "hook-notifier");
++   hook_tray_icon_init(un->hook);
++
++   /* reboot required icon */
++   un->reboot = g_new0 (TrayApplet, 1);
++   trayapplet_create(un->reboot, "reboot-notifier");
++   reboot_tray_icon_init(un->reboot);
++
++   /* crashreport detected icon */
++   un->crashreport = g_new0 (TrayApplet, 1);
++   trayapplet_create(un->crashreport, "apport");
++   crashreport_tray_icon_init(un->crashreport);
++
++   return FALSE; // for the tray_destroyed_cb
++}
++
++// this function checks if the user is in the admin group
++// if there is no admin group, we return true becuase there
++// is no way to figure if the user is a admin or not
++gboolean
++in_admin_group()
++{
++   int i, ng = 0;
++   gid_t *groups = NULL;
++
++   struct group *grp = getgrnam("admin");
++   if(grp == NULL) 
++      return TRUE;
++
++   ng = getgroups (0, NULL);
++   groups = (gid_t *) malloc (ng * sizeof (gid_t));
++
++   i = getgroups (ng, groups);
++   if (i != ng) {
++     free (groups);
++     return TRUE;
++   }
++   
++   for(i=0;i<ng;i++) {
++      if(groups[i] == grp->gr_gid) {
++        free(groups);
++        return TRUE;
++      }
++   }
++   
++   if(groups != NULL)
++      free(groups);
++
++   return FALSE;
++}
++
++static GOptionEntry entries[] = 
++{
++   { "debug-hooks", 0, 0, G_OPTION_ARG_NONE, &HOOK_DEBUG, "Enable hooks debugging"},
++   { NULL }
++};
++
++int 
++main (int argc, char *argv[])
++{
++	GnomeClient *client;
++	UpgradeNotifier *un;
++
++	// option parsing
++	GOptionContext *context;
++	context = g_option_context_new (" - inform about updates");
++	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
++	gnome_program_init (PACKAGE, PACKAGE_VERSION, 
++			    LIBGNOMEUI_MODULE,
++			    argc, argv, 
++			    GNOME_PARAM_GOPTION_CONTEXT, context,
++			    GNOME_PARAM_NONE);
++	notify_init("update-notifier");
++        bindtextdomain(PACKAGE, PACKAGE_LOCALE_DIR);
++        bind_textdomain_codeset(PACKAGE, "UTF-8");
++        textdomain(PACKAGE);
++
++	g_set_application_name (_("update-notifier"));
++	gtk_window_set_default_icon_name ("update-notifier");
++
++	//g_print("starting update-notifier\n");
++	
++	// check if we should run at all (see HideAdminTools spec
++	// on https://wiki.ubuntu.com/HideAdminToolsToUsers)
++	if(!in_admin_group()) {
++	   g_warning("not starting because user is not in admin group\n");
++	   exit(0);
++	}
++
++	client = gnome_master_client ();
++	if (up_get_clipboard ())
++	  gnome_client_set_restart_style (client, GNOME_RESTART_ANYWAY);
++	else {
++	   gnome_client_set_restart_style (client, GNOME_RESTART_NEVER);
++	   g_warning ("already running?\n");
++	   return 1;
++	}
++
++	/* Make sure we die when the session dies */
++	g_signal_connect (G_OBJECT (client), "die",
++			  G_CALLBACK (gtk_main_quit), NULL);
++	
++	/* Create the UpgradeNotifier object */
++	un = g_new0 (UpgradeNotifier, 1);
++
++	// check for .update-notifier dir and create if needed
++	gchar *dirname = g_strdup_printf("%s/.update-notifier",
++					 g_get_home_dir());
++	if(!g_file_test(dirname, G_FILE_TEST_IS_DIR))
++	   g_mkdir(dirname, 0700);
++	g_free(dirname);
++
++	// create the icons with a timeout
++	//g_timeout_add(5000, (GSourceFunc)(tray_icons_init), un);
++	tray_icons_init(un);
++
++        // initial check for avahi
++        avahi_disabled_check();
++
++	// init hal (needs to be done _after_ the icons are created)
++	/* setup hal so that inserted cdroms can be checked */
++	LibHalContext *hal_ctx = up_do_hal_init();
++	if (!hal_ctx) {
++	   u_abort("failed to initialize HAL!\n");
++	   return 1;
++	}
++	libhal_ctx_set_user_data(hal_ctx, un);
++	
++	// init fam
++	monitor_init(un);
++	
++	/* Start the main gtk loop */
++	gtk_main ();
++
++	return 0;
++}




More information about the pkg-gnome-commits mailing list