~ubuntu-branches/ubuntu/raring/systemd/raring-proposed

« back to all changes in this revision

Viewing changes to src/locale/localed.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2013-03-15 11:37:45 UTC
  • Revision ID: package-import@ubuntu.com-20130315113745-ftk9oan7462l488q
Tags: 198-0ubuntu3
* Add 0018-Add-env-variable-for-machine-ID-path.patch: During package build,
  in minimal chroots, or other systems which do not already have an
  /etc/machine-id we get six test failures. Introduce a
  $SYSTEMD_MACHINE_ID_PATH environment variable which can specify a location
  other than /etc/machine-id, so that the unit tests are independent from
  the environment.
* debian/rules: Re-enable unit tests. Don't run them under fakeroot as that
  hangs some tests, and supply a local machine id file.
* Add autopkgtests for hostnamed, localed, and timedated.
* 0010-Add-back-support-for-Debian-specific-config-files.patch: Update patch
  for localed to use /etc/default/locale instead of /etc/locale.conf.
* Rename udev-gtk-udeb to libudev1-udeb, and build it for Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
216
216
                           "LC_IDENTIFICATION", &data[PROP_LC_IDENTIFICATION],
217
217
                           NULL);
218
218
 
 
219
        if (r == -ENOENT)
 
220
                r = parse_env_file("/etc/default/locale", NEWLINE,
 
221
                                   "LANG",              &data[PROP_LANG],
 
222
                                   "LANGUAGE",          &data[PROP_LANGUAGE],
 
223
                                   "LC_CTYPE",          &data[PROP_LC_CTYPE],
 
224
                                   "LC_NUMERIC",        &data[PROP_LC_NUMERIC],
 
225
                                   "LC_TIME",           &data[PROP_LC_TIME],
 
226
                                   "LC_COLLATE",        &data[PROP_LC_COLLATE],
 
227
                                   "LC_MONETARY",       &data[PROP_LC_MONETARY],
 
228
                                   "LC_MESSAGES",       &data[PROP_LC_MESSAGES],
 
229
                                   "LC_PAPER",          &data[PROP_LC_PAPER],
 
230
                                   "LC_NAME",           &data[PROP_LC_NAME],
 
231
                                   "LC_ADDRESS",        &data[PROP_LC_ADDRESS],
 
232
                                   "LC_TELEPHONE",      &data[PROP_LC_TELEPHONE],
 
233
                                   "LC_MEASUREMENT",    &data[PROP_LC_MEASUREMENT],
 
234
                                   "LC_IDENTIFICATION", &data[PROP_LC_IDENTIFICATION],
 
235
                                   NULL);
 
236
 
219
237
        if (r == -ENOENT) {
220
238
                int p;
221
239
 
354
372
static int write_data_locale(void) {
355
373
        int r, p;
356
374
        char **l = NULL;
 
375
        const char *path = "/etc/locale.conf";
357
376
 
358
 
        r = load_env_file("/etc/locale.conf", &l);
 
377
        r = load_env_file(path, &l);
 
378
        if (r < 0 && r == -ENOENT) {
 
379
                path = "/etc/default/locale";
 
380
                r = load_env_file(path, &l);
 
381
        }
359
382
        if (r < 0 && r != -ENOENT)
360
383
                return r;
361
384
 
387
410
        if (strv_isempty(l)) {
388
411
                strv_free(l);
389
412
 
390
 
                if (unlink("/etc/locale.conf") < 0)
 
413
                if (unlink(path) < 0)
391
414
                        return errno == ENOENT ? 0 : -errno;
392
415
 
393
416
                return 0;
394
417
        }
395
418
 
396
 
        r = write_env_file_label("/etc/locale.conf", l);
 
419
        r = write_env_file_label(path, l);
397
420
        strv_free(l);
398
421
 
399
422
        return r;