localectl.c revision ff9b60f38bf68eba4a47cabff14547d92e083214
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering This file is part of systemd.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Copyright 2012 Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Copyright 2013 Kay Sievers
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is free software; you can redistribute it and/or modify it
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering under the terms of the GNU Lesser General Public License as published by
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering (at your option) any later version.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is distributed in the hope that it will be useful, but
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Lesser General Public License for more details.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering You should have received a copy of the GNU Lesser General Public License
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
0dd25fb9f005d8ab7ac4bc10a609d00569f8c56aLennart Poetteringstatic bool arg_no_pager = false;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic bool arg_ask_password = true;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic bool arg_convert = true;
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poetteringstatic void pager_open_if_enabled(void) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic void polkit_agent_open_if_enabled(void) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* Open the polkit agent as a child process if necessary */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (arg_transport != BUS_TRANSPORT_LOCAL)
af49ca27ffd790d78dbbb465b978266dfd5c93daLennart Poetteringtypedef struct StatusInfo {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic void print_overridden_variables(void) {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (detect_container(NULL) > 0 || arg_host)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering r = parse_env_file("/proc/cmdline", WHITESPACE,
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering "locale.LANGUAGE", &variables[VARIABLE_LANGUAGE],
011696f76233486bc56c266b18a328924f70269cLennart Poettering "locale.LC_CTYPE", &variables[VARIABLE_LC_CTYPE],
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering "locale.LC_NUMERIC", &variables[VARIABLE_LC_NUMERIC],
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering "locale.LC_TIME", &variables[VARIABLE_LC_TIME],
2c27fbca2d88214bd305272308a370a962818f1eLennart Poettering "locale.LC_COLLATE", &variables[VARIABLE_LC_COLLATE],
97e5d693c04e50605d438af1c8a965fd2963bbe9Lennart Poettering "locale.LC_MONETARY", &variables[VARIABLE_LC_MONETARY],
97e5d693c04e50605d438af1c8a965fd2963bbe9Lennart Poettering "locale.LC_MESSAGES", &variables[VARIABLE_LC_MESSAGES],
97e5d693c04e50605d438af1c8a965fd2963bbe9Lennart Poettering "locale.LC_PAPER", &variables[VARIABLE_LC_PAPER],
97e5d693c04e50605d438af1c8a965fd2963bbe9Lennart Poettering "locale.LC_NAME", &variables[VARIABLE_LC_NAME],
2c27fbca2d88214bd305272308a370a962818f1eLennart Poettering "locale.LC_ADDRESS", &variables[VARIABLE_LC_ADDRESS],
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering "locale.LC_TELEPHONE", &variables[VARIABLE_LC_TELEPHONE],
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering "locale.LC_MEASUREMENT", &variables[VARIABLE_LC_MEASUREMENT],
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering "locale.LC_IDENTIFICATION", &variables[VARIABLE_LC_IDENTIFICATION],
c69fa7e3c44240bedc0ee1bd89fecf954783ac85Lennart Poettering if (r < 0 && r != -ENOENT) {
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering log_warning_errno(r, "Failed to read /proc/cmdline: %m");
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poettering for (j = 0; j < _VARIABLE_LC_MAX; j++)
log_warning("Warning: Settings on kernel command line override system locale settings in /etc/locale.conf.\n"
print_warning = false;
for (j = 0; j < _VARIABLE_LC_MAX; j++)
assert(i);
"/org/freedesktop/locale1",
map,
&info);
goto fail;
fail:
bus,
"/org/freedesktop/locale1",
return bus_log_create_error(r);
return bus_log_create_error(r);
return bus_log_create_error(r);
r = get_locales(&l);
strv_print(l);
return -EINVAL;
r = sd_bus_call_method(
bus,
"/org/freedesktop/locale1",
&error,
NULL,
static int nftw_cb(
const char *fpath,
int tflag,
return log_oom();
if (r < 0 && r != -EEXIST)
const char *dir;
if (!keymaps)
return log_oom();
return log_oom();
if (strv_isempty(l)) {
return -ENOENT;
strv_sort(l);
strv_print(l);
return -EINVAL;
r = sd_bus_call_method(
bus,
"/org/freedesktop/locale1",
&error,
NULL,
NONE,
return -EINVAL;
if (isempty(l))
return log_oom();
return -ENOENT;
static void help(void) {
help();
case ARG_VERSION:
case ARG_NO_CONVERT:
arg_convert = false;
case ARG_NO_PAGER:
arg_no_pager = true;
case ARG_NO_ASK_PASSWORD:
arg_ask_password = false;
return -EINVAL;
const char* verb;
MORE,
LESS,
} argc_cmp;
const int argc;
} verbs[] = {
int left;
if (left <= 0)
help();
return -EINVAL;
case EQUAL:
return -EINVAL;
case MORE:
return -EINVAL;
case LESS:
return -EINVAL;
log_open();
goto finish;
goto finish;
pager_close();