~ubuntu-branches/debian/sid/apt-dater/sid

« back to all changes in this revision

Viewing changes to src/apt-dater.c

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2015-07-07 17:33:08 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20150707173308-7rkjhxnlq7gsykif
Tags: 1.0.2-1
* New upstream release.
  - Set the default of the opt-cmd-flags host option to "-t" since this is
    essential.
    Closes: #776392
  - Add new build dependency vim-common.
* Replace screen dependency with tmux.
* Create apt-dater group for session sharing.
* Add missing directories.
* Make the build reproducible.
  Closes: #789648
* Drop automake and autoconf build dependencies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 *   Thomas Liske <liske@ibh.de>
5
5
 *
6
6
 * Copyright Holder:
7
 
 *   2008-2014 (C) IBH IT-Service GmbH [https://www.ibh.de/apt-dater/]
 
7
 *   2008-2015 (C) IBH IT-Service GmbH [https://www.ibh.de/apt-dater/]
8
8
 *
9
9
 * License:
10
10
 *   This program is free software; you can redistribute it and/or modify
45
45
#include "report.h"
46
46
#endif
47
47
 
48
 
#define VERSTEXT PACKAGE_STRING " - " __DATE__ " " __TIME__ "\n\n" \
 
48
#ifndef SOURCE_DATE_UTC
 
49
#error SOURCE_DATE_UTC is undefined!
 
50
#endif
 
51
 
 
52
#define VERSTEXT PACKAGE_STRING " - " SOURCE_DATE_UTC "\n\n" \
49
53
  "Copyright Holder: IBH IT-Service GmbH [https://www.ibh.net/]\n\n" \
50
54
  "This program is free software; you can redistribute it and/or modify\n" \
51
55
  "it under the terms of the GNU General Public License as published by\n" \
75
79
 textdomain(PACKAGE);
76
80
#endif
77
81
 
 
82
#ifdef REQUIRE_GLIB_TYPE_INIT
 
83
 g_type_init();
 
84
#endif
 
85
 
78
86
 cfgdirname = g_strdup_printf("%s/%s", g_get_user_config_dir(), PACKAGE);
79
87
 if(!cfgdirname) g_error(_("Out of memory."));
80
88
 
153
161
  }
154
162
  /* Add keys */
155
163
  else {
156
 
    gint i;
157
 
    gchar **add_argv = g_new0(gchar *, cfg->ssh_numadd+2);
158
 
 
159
 
    add_argv[0] = "ssh-add";
160
 
 
161
 
    for(i=0; i<cfg->ssh_numadd; i++)
162
 
     add_argv[i+1] = cfg->ssh_add[i];
163
 
 
164
 
    GError *error;
165
 
    if(g_spawn_sync(NULL, add_argv, NULL, 
166
 
         G_SPAWN_SEARCH_PATH | G_SPAWN_CHILD_INHERITS_STDIN, NULL, NULL,
167
 
         NULL, NULL, NULL, &error) == FALSE) {
168
 
      g_warning("%s", error->message);
169
 
      g_clear_error (&error);
 
164
    if(cfg->ssh_numadd) {
 
165
        gint i;
 
166
        gchar **add_argv = g_new0(gchar *, cfg->ssh_numadd+2);
 
167
 
 
168
        add_argv[0] = PKGLIBDIR"/ssh-addonce";
 
169
 
 
170
        for(i=0; i<cfg->ssh_numadd; i++)
 
171
         add_argv[i+1] = cfg->ssh_add[i];
 
172
 
 
173
        GError *error = NULL;
 
174
        if(g_spawn_sync(NULL, add_argv, NULL,
 
175
             G_SPAWN_SEARCH_PATH | G_SPAWN_CHILD_INHERITS_STDIN, NULL, NULL,
 
176
             NULL, NULL, NULL, &error) == FALSE) {
 
177
          g_warning("%s", error->message);
 
178
          g_clear_error (&error);
 
179
        }
 
180
 
 
181
        g_free(add_argv);
170
182
    }
171
 
 
172
 
    g_free(add_argv);
173
183
  }
174
184
 }
175
185
 
178
188
#ifdef FEAT_XMLREPORT
179
189
 if(!report) {
180
190
#endif
 
191
 
 
192
#ifndef FEAT_TMUX
181
193
#ifdef __linux__
182
194
   /* Test if we are the owner of the TTY or die. */
183
195
   if(g_access("/proc/self/fd/0", R_OK|W_OK)) {
185
197
     exit(EXIT_FAILURE);
186
198
   }
187
199
#endif
 
200
#endif
188
201
 
189
202
   getOldestMtime(hosts);
190
203
 
202
215
 
203
216
 loop = g_main_loop_new (NULL, FALSE);
204
217
 
205
 
#ifdef HAVE_GLIB_TIMEOUT_ADD_SECONDS
 
218
 /* tmux supports GFileMonitor, screen requires polling */
 
219
#ifdef FEAT_TMUX
 
220
 refreshStats(hosts);
 
221
#else
206
222
 g_timeout_add_seconds(1, (GSourceFunc) refreshStats, hosts);
207
 
#else
208
 
 g_timeout_add(1000, (GSourceFunc) refreshStats, hosts);
209
223
#endif
210
 
 
 
224
 
211
225
#ifdef FEAT_XMLREPORT
212
226
 if(report)
213
227
  g_idle_add ((GSourceFunc) ctrlReport, hosts);