~ubuntu-core-dev/update-notifier/ubuntu

« back to all changes in this revision

Viewing changes to src/update-notifier.c

  • Committer: Michael Vogt
  • Date: 2010-06-29 19:31:20 UTC
  • Revision ID: michael.vogt@ubuntu.com-20100629193120-ewgtl843x57g1cjt
add /usr/share/update-notifier/plugins/cache-changed dir
that can be used to trigger scripts on cache change (update,
install, remove, upgrade) that are run within the users
context (e.g. oneconf) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
264
264
      // check updates
265
265
      update_check(un->update);
266
266
 
 
267
      // run cache-changed plugin scripts
 
268
      GDir *dir = g_dir_open(CACHE_CHANGED_PLUGIN_DIR, 0, NULL);
 
269
      const gchar *fname, *full_path;
 
270
      while ( (fname = g_dir_read_name(dir)) != NULL ) {
 
271
         g_print("fname: %s\n", fname);
 
272
         full_path = g_strdup_printf("%s/%s", CACHE_CHANGED_PLUGIN_DIR, fname);
 
273
         if (g_file_test(full_path, G_FILE_TEST_IS_EXECUTABLE )) {
 
274
            const gchar *argv[] = { full_path, NULL };
 
275
            g_spawn_async("/", argv, NULL, 0, NULL, NULL, 0, NULL);
 
276
         }
 
277
         g_free(full_path);
 
278
      }
 
279
 
267
280
      // any apt-get update  must be finished, otherwise 
268
281
      // apt-get install wouldn't be finished
269
282
      update_apt_is_running(un->update, FALSE);