mirror of
https://https.git.savannah.gnu.org/git/guix.git/
synced 2025-07-12 10:00:46 +02:00
gnu: localed: Update to 257.4.
* gnu/packages/freedesktop.scm (localed): Update to 257.4. [source]: Streamline snippet; no longer adjust to use /var/run instead of /run. [arguments] <#:phases>: Adjust set-xkeyboard-config-file-name phase. * gnu/packages/patches/localed-xorg-keyboard.patch: Rebase patch. Change-Id: I3853ee2b64b7f48ea4592aa206ecee86a7164185
This commit is contained in:
parent
383f7f5c89
commit
41c40bc1cf
2 changed files with 175 additions and 182 deletions
|
@ -1060,7 +1060,7 @@ This library provides just sd-bus (and the busctl utility).")
|
||||||
;; that it would make more sense to maintain a fork of the bits we need.
|
;; that it would make more sense to maintain a fork of the bits we need.
|
||||||
(package
|
(package
|
||||||
(name "localed")
|
(name "localed")
|
||||||
(version "241")
|
(version "257.4")
|
||||||
(source (origin
|
(source (origin
|
||||||
(method git-fetch)
|
(method git-fetch)
|
||||||
(uri (git-reference
|
(uri (git-reference
|
||||||
|
@ -1068,18 +1068,11 @@ This library provides just sd-bus (and the busctl utility).")
|
||||||
(commit (string-append "v" version))))
|
(commit (string-append "v" version))))
|
||||||
(sha256
|
(sha256
|
||||||
(base32
|
(base32
|
||||||
"0sy91flzbhpq58k7v0294pa2gxpr0bk27rcnxlbhk2fi6nc51d28"))
|
"06fackmig43p9xx1155vrr5bx8a6a1cfb958x5acxvvahi8lkg7a"))
|
||||||
(file-name (git-file-name name version))
|
(file-name (git-file-name name version))
|
||||||
(modules '((guix build utils)))
|
(modules '((guix build utils)))
|
||||||
(snippet
|
(snippet
|
||||||
'(begin
|
'(begin
|
||||||
;; Connect to the right location for our D-Bus daemon.
|
|
||||||
(substitute* '("src/basic/def.h"
|
|
||||||
"src/libsystemd/sd-bus/sd-bus.c"
|
|
||||||
"src/stdio-bridge/stdio-bridge.c")
|
|
||||||
(("/run/dbus/system_bus_socket")
|
|
||||||
"/var/run/dbus/system_bus_socket"))
|
|
||||||
|
|
||||||
;; Don't insist on having systemd as PID 1 (otherwise
|
;; Don't insist on having systemd as PID 1 (otherwise
|
||||||
;; 'localectl' would exit without doing anything.)
|
;; 'localectl' would exit without doing anything.)
|
||||||
(substitute* "src/shared/bus-util.c"
|
(substitute* "src/shared/bus-util.c"
|
||||||
|
@ -1143,7 +1136,7 @@ This library provides just sd-bus (and the busctl utility).")
|
||||||
(substitute* "src/locale/localectl.c"
|
(substitute* "src/locale/localectl.c"
|
||||||
(("/usr/share/X11/xkb/rules")
|
(("/usr/share/X11/xkb/rules")
|
||||||
(string-append xkb "/share/X11/xkb/rules")))
|
(string-append xkb "/share/X11/xkb/rules")))
|
||||||
(substitute* "src/basic/def.h"
|
(substitute* "src/shared/kbd-util.c"
|
||||||
(("/usr/share/keymaps")
|
(("/usr/share/keymaps")
|
||||||
(string-append kbd "/share/keymaps"))))))
|
(string-append kbd "/share/keymaps"))))))
|
||||||
(replace 'install
|
(replace 'install
|
||||||
|
|
|
@ -9,38 +9,54 @@ stateful bits that would write configuration to /etc/vconsole.conf
|
||||||
and /etc/X11, which are unused in Guix anyway.
|
and /etc/X11, which are unused in Guix anyway.
|
||||||
|
|
||||||
Patch by Ludovic Courtès <ludo@gnu.org>.
|
Patch by Ludovic Courtès <ludo@gnu.org>.
|
||||||
|
Ported from v241 to v257 by Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
||||||
|
|
||||||
diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c
|
diff --git a/src/locale/localed-util.c b/src/locale/localed-util.c
|
||||||
index 6b6b32a591..46aab472b0 100644
|
index 6413288ea3..c2a1c70e9e 100644
|
||||||
--- a/src/locale/keymap-util.c
|
--- a/src/locale/localed-util.c
|
||||||
+++ b/src/locale/keymap-util.c
|
+++ b/src/locale/localed-util.c
|
||||||
@@ -174,32 +174,16 @@ int vconsole_read_data(Context *c, sd_bus_message *m) {
|
@@ -349,47 +349,18 @@ int vconsole_read_data(Context *c, sd_bus_message *m) {
|
||||||
c->vc_cache = sd_bus_message_ref(m);
|
c->vc_cache = sd_bus_message_ref(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
- if (stat("/etc/vconsole.conf", &st) < 0) {
|
- fd = RET_NERRNO(open("/etc/vconsole.conf", O_CLOEXEC | O_PATH));
|
||||||
- if (errno != ENOENT)
|
- if (fd == -ENOENT) {
|
||||||
- return -errno;
|
- c->vc_stat = (struct stat) {};
|
||||||
-
|
- vc_context_clear(&c->vc);
|
||||||
- c->vc_mtime = USEC_INFINITY;
|
- x11_context_clear(&c->x11_from_vc);
|
||||||
- context_free_vconsole(c);
|
|
||||||
- return 0;
|
- return 0;
|
||||||
- }
|
- }
|
||||||
|
- if (fd < 0)
|
||||||
|
- return fd;
|
||||||
-
|
-
|
||||||
- /* If mtime is not changed, then we do not need to re-read */
|
- if (fstat(fd, &st) < 0)
|
||||||
- t = timespec_load(&st.st_mtim);
|
- return -errno;
|
||||||
- if (c->vc_mtime != USEC_INFINITY && t == c->vc_mtime)
|
-
|
||||||
|
- /* If the file is not changed, then we do not need to re-read */
|
||||||
|
- if (stat_inode_unmodified(&c->vc_stat, &st))
|
||||||
- return 0;
|
- return 0;
|
||||||
-
|
-
|
||||||
- c->vc_mtime = t;
|
- c->vc_stat = st;
|
||||||
+ c->vc_mtime = USEC_INFINITY;
|
+ c->vc_stat = (struct stat) {};
|
||||||
context_free_vconsole(c);
|
vc_context_clear(&c->vc);
|
||||||
-
|
x11_context_clear(&c->x11_from_vc);
|
||||||
- r = parse_env_file(NULL, "/etc/vconsole.conf",
|
|
||||||
- "KEYMAP", &c->vc_keymap,
|
- r = parse_env_file_fd(
|
||||||
- "KEYMAP_TOGGLE", &c->vc_keymap_toggle);
|
- fd, "/etc/vconsole.conf",
|
||||||
|
- "KEYMAP", &c->vc.keymap,
|
||||||
|
- "KEYMAP_TOGGLE", &c->vc.toggle,
|
||||||
|
- "XKBLAYOUT", &c->x11_from_vc.layout,
|
||||||
|
- "XKBMODEL", &c->x11_from_vc.model,
|
||||||
|
- "XKBVARIANT", &c->x11_from_vc.variant,
|
||||||
|
- "XKBOPTIONS", &c->x11_from_vc.options);
|
||||||
- if (r < 0)
|
- if (r < 0)
|
||||||
- return r;
|
- return r;
|
||||||
|
-
|
||||||
|
- if (vc_context_verify(&c->vc) < 0)
|
||||||
|
- vc_context_clear(&c->vc);
|
||||||
|
-
|
||||||
|
- if (x11_context_verify(&c->x11_from_vc) < 0)
|
||||||
|
- x11_context_clear(&c->x11_from_vc);
|
||||||
-
|
-
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -51,52 +67,52 @@ index 6b6b32a591..46aab472b0 100644
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
int x11_read_data(Context *c, sd_bus_message *m) {
|
int x11_read_data(Context *c, sd_bus_message *m) {
|
||||||
|
_cleanup_close_ int fd = -EBADF;
|
||||||
_cleanup_fclose_ FILE *f = NULL;
|
_cleanup_fclose_ FILE *f = NULL;
|
||||||
bool in_section = false;
|
@@ -408,195 +379,23 @@ int x11_read_data(Context *c, sd_bus_message *m) {
|
||||||
@@ -216,258 +200,27 @@ int x11_read_data(Context *c, sd_bus_message *m) {
|
|
||||||
c->x11_cache = sd_bus_message_ref(m);
|
c->x11_cache = sd_bus_message_ref(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
- if (stat("/etc/X11/xorg.conf.d/00-keyboard.conf", &st) < 0) {
|
- fd = RET_NERRNO(open("/etc/X11/xorg.conf.d/00-keyboard.conf", O_CLOEXEC | O_PATH));
|
||||||
- if (errno != ENOENT)
|
- if (fd == -ENOENT) {
|
||||||
- return -errno;
|
- c->x11_stat = (struct stat) {};
|
||||||
-
|
- x11_context_clear(&c->x11_from_xorg);
|
||||||
- c->x11_mtime = USEC_INFINITY;
|
|
||||||
- context_free_x11(c);
|
|
||||||
- return 0;
|
- return 0;
|
||||||
- }
|
- }
|
||||||
|
- if (fd < 0)
|
||||||
|
- return fd;
|
||||||
-
|
-
|
||||||
- /* If mtime is not changed, then we do not need to re-read */
|
- if (fstat(fd, &st) < 0)
|
||||||
- t = timespec_load(&st.st_mtim);
|
- return -errno;
|
||||||
- if (c->x11_mtime != USEC_INFINITY && t == c->x11_mtime)
|
-
|
||||||
|
- /* If the file is not changed, then we do not need to re-read */
|
||||||
|
- if (stat_inode_unmodified(&c->x11_stat, &st))
|
||||||
- return 0;
|
- return 0;
|
||||||
-
|
-
|
||||||
- c->x11_mtime = t;
|
- c->x11_stat = st;
|
||||||
+ c->x11_mtime = 0;
|
+ c->x11_stat = (struct stat) {};
|
||||||
context_free_x11(c);
|
x11_context_clear(&c->x11_from_xorg);
|
||||||
|
|
||||||
- f = fopen("/etc/X11/xorg.conf.d/00-keyboard.conf", "re");
|
- r = fdopen_independent(fd, "re", &f);
|
||||||
- if (!f)
|
- if (r < 0)
|
||||||
- return -errno;
|
- return r;
|
||||||
-
|
-
|
||||||
- for (;;) {
|
- for (;;) {
|
||||||
- _cleanup_free_ char *line = NULL;
|
- _cleanup_free_ char *line = NULL;
|
||||||
- char *l;
|
|
||||||
-
|
-
|
||||||
- r = read_line(f, LONG_LINE_MAX, &line);
|
- r = read_stripped_line(f, LONG_LINE_MAX, &line);
|
||||||
- if (r < 0)
|
- if (r < 0)
|
||||||
- return r;
|
- return r;
|
||||||
- if (r == 0)
|
- if (r == 0)
|
||||||
- break;
|
- break;
|
||||||
-
|
-
|
||||||
- l = strstrip(line);
|
- if (IN_SET(line[0], 0, '#'))
|
||||||
- if (IN_SET(l[0], 0, '#'))
|
|
||||||
- continue;
|
- continue;
|
||||||
-
|
-
|
||||||
- if (in_section && first_word(l, "Option")) {
|
- if (in_section && first_word(line, "Option")) {
|
||||||
- _cleanup_strv_free_ char **a = NULL;
|
- _cleanup_strv_free_ char **a = NULL;
|
||||||
-
|
-
|
||||||
- r = strv_split_extract(&a, l, WHITESPACE, EXTRACT_QUOTES);
|
- r = strv_split_full(&a, line, WHITESPACE, EXTRACT_UNQUOTE);
|
||||||
- if (r < 0)
|
- if (r < 0)
|
||||||
- return r;
|
- return r;
|
||||||
-
|
-
|
||||||
|
@ -104,146 +120,93 @@ index 6b6b32a591..46aab472b0 100644
|
||||||
- char **p = NULL;
|
- char **p = NULL;
|
||||||
-
|
-
|
||||||
- if (streq(a[1], "XkbLayout"))
|
- if (streq(a[1], "XkbLayout"))
|
||||||
- p = &c->x11_layout;
|
- p = &c->x11_from_xorg.layout;
|
||||||
- else if (streq(a[1], "XkbModel"))
|
- else if (streq(a[1], "XkbModel"))
|
||||||
- p = &c->x11_model;
|
- p = &c->x11_from_xorg.model;
|
||||||
- else if (streq(a[1], "XkbVariant"))
|
- else if (streq(a[1], "XkbVariant"))
|
||||||
- p = &c->x11_variant;
|
- p = &c->x11_from_xorg.variant;
|
||||||
- else if (streq(a[1], "XkbOptions"))
|
- else if (streq(a[1], "XkbOptions"))
|
||||||
- p = &c->x11_options;
|
- p = &c->x11_from_xorg.options;
|
||||||
-
|
-
|
||||||
- if (p) {
|
- if (p)
|
||||||
- free_and_replace(*p, a[2]);
|
- free_and_replace(*p, a[2]);
|
||||||
- }
|
- }
|
||||||
- }
|
|
||||||
-
|
-
|
||||||
- } else if (!in_section && first_word(l, "Section")) {
|
- } else if (!in_section && first_word(line, "Section")) {
|
||||||
- _cleanup_strv_free_ char **a = NULL;
|
- _cleanup_strv_free_ char **a = NULL;
|
||||||
-
|
-
|
||||||
- r = strv_split_extract(&a, l, WHITESPACE, EXTRACT_QUOTES);
|
- r = strv_split_full(&a, line, WHITESPACE, EXTRACT_UNQUOTE);
|
||||||
- if (r < 0)
|
- if (r < 0)
|
||||||
- return -ENOMEM;
|
- return -ENOMEM;
|
||||||
-
|
-
|
||||||
- if (strv_length(a) == 2 && streq(a[1], "InputClass"))
|
- if (strv_length(a) == 2 && streq(a[1], "InputClass"))
|
||||||
- in_section = true;
|
- in_section = true;
|
||||||
-
|
-
|
||||||
- } else if (in_section && first_word(l, "EndSection"))
|
- } else if (in_section && first_word(line, "EndSection"))
|
||||||
- in_section = false;
|
- in_section = false;
|
||||||
- }
|
- }
|
||||||
+ c->x11_layout = getenv_strdup("GUIX_XKB_LAYOUT");
|
-
|
||||||
+ c->x11_model = getenv_strdup("GUIX_XKB_MODEL");
|
- if (x11_context_verify(&c->x11_from_xorg) < 0)
|
||||||
+ c->x11_variant = getenv_strdup("GUIX_XKB_VARIANT");
|
- x11_context_clear(&c->x11_from_xorg);
|
||||||
+ c->x11_options = getenv_strdup("GUIX_XKB_OPTIONS");
|
+ c->x11_from_xorg.layout = getenv_strdup("GUIX_XKB_LAYOUT");
|
||||||
|
+ c->x11_from_xorg.model = getenv_strdup("GUIX_XKB_MODEL");
|
||||||
|
+ c->x11_from_xorg.variant = getenv_strdup("GUIX_XKB_VARIANT");
|
||||||
|
+ c->x11_from_xorg.options = getenv_strdup("GUIX_XKB_OPTIONS");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int locale_write_data(Context *c, char ***settings) {
|
|
||||||
- _cleanup_strv_free_ char **l = NULL;
|
|
||||||
- struct stat st;
|
|
||||||
- int r, p;
|
|
||||||
-
|
|
||||||
- /* Set values will be returned as strv in *settings on success. */
|
|
||||||
-
|
|
||||||
- for (p = 0; p < _VARIABLE_LC_MAX; p++) {
|
|
||||||
- _cleanup_free_ char *t = NULL;
|
|
||||||
- char **u;
|
|
||||||
- const char *name;
|
|
||||||
-
|
|
||||||
- name = locale_variable_to_string(p);
|
|
||||||
- assert(name);
|
|
||||||
-
|
|
||||||
- if (isempty(c->locale[p]))
|
|
||||||
- continue;
|
|
||||||
-
|
|
||||||
- if (asprintf(&t, "%s=%s", name, c->locale[p]) < 0)
|
|
||||||
- return -ENOMEM;
|
|
||||||
-
|
|
||||||
- u = strv_env_set(l, t);
|
|
||||||
- if (!u)
|
|
||||||
- return -ENOMEM;
|
|
||||||
-
|
|
||||||
- strv_free_and_replace(l, u);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (strv_isempty(l)) {
|
|
||||||
- if (unlink("/etc/locale.conf") < 0)
|
|
||||||
- return errno == ENOENT ? 0 : -errno;
|
|
||||||
-
|
|
||||||
- c->locale_mtime = USEC_INFINITY;
|
|
||||||
- return 0;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- r = write_env_file_label("/etc/locale.conf", l);
|
|
||||||
- if (r < 0)
|
|
||||||
- return r;
|
|
||||||
-
|
|
||||||
- *settings = TAKE_PTR(l);
|
|
||||||
-
|
|
||||||
- if (stat("/etc/locale.conf", &st) >= 0)
|
|
||||||
- c->locale_mtime = timespec_load(&st.st_mtim);
|
|
||||||
-
|
|
||||||
- return 0;
|
|
||||||
+ return -ENOSYS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int vconsole_write_data(Context *c) {
|
int vconsole_write_data(Context *c) {
|
||||||
- _cleanup_strv_free_ char **l = NULL;
|
- _cleanup_strv_free_ char **l = NULL;
|
||||||
- struct stat st;
|
- const X11Context *xc;
|
||||||
- int r;
|
- int r;
|
||||||
-
|
-
|
||||||
|
- assert(c);
|
||||||
|
-
|
||||||
|
- xc = context_get_x11_context(c);
|
||||||
|
-
|
||||||
- r = load_env_file(NULL, "/etc/vconsole.conf", &l);
|
- r = load_env_file(NULL, "/etc/vconsole.conf", &l);
|
||||||
- if (r < 0 && r != -ENOENT)
|
- if (r < 0 && r != -ENOENT)
|
||||||
- return r;
|
- return r;
|
||||||
-
|
-
|
||||||
- if (isempty(c->vc_keymap))
|
- r = strv_env_assign(&l, "KEYMAP", empty_to_null(c->vc.keymap));
|
||||||
- l = strv_env_unset(l, "KEYMAP");
|
- if (r < 0)
|
||||||
- else {
|
- return r;
|
||||||
- _cleanup_free_ char *s = NULL;
|
|
||||||
- char **u;
|
|
||||||
-
|
-
|
||||||
- s = strappend("KEYMAP=", c->vc_keymap);
|
- r = strv_env_assign(&l, "KEYMAP_TOGGLE", empty_to_null(c->vc.toggle));
|
||||||
- if (!s)
|
- if (r < 0)
|
||||||
- return -ENOMEM;
|
- return r;
|
||||||
-
|
-
|
||||||
- u = strv_env_set(l, s);
|
- r = strv_env_assign(&l, "XKBLAYOUT", empty_to_null(xc->layout));
|
||||||
- if (!u)
|
- if (r < 0)
|
||||||
- return -ENOMEM;
|
- return r;
|
||||||
-
|
-
|
||||||
- strv_free_and_replace(l, u);
|
- r = strv_env_assign(&l, "XKBMODEL", empty_to_null(xc->model));
|
||||||
- }
|
- if (r < 0)
|
||||||
|
- return r;
|
||||||
-
|
-
|
||||||
- if (isempty(c->vc_keymap_toggle))
|
- r = strv_env_assign(&l, "XKBVARIANT", empty_to_null(xc->variant));
|
||||||
- l = strv_env_unset(l, "KEYMAP_TOGGLE");
|
- if (r < 0)
|
||||||
- else {
|
- return r;
|
||||||
- _cleanup_free_ char *s = NULL;
|
|
||||||
- char **u;
|
|
||||||
-
|
-
|
||||||
- s = strappend("KEYMAP_TOGGLE=", c->vc_keymap_toggle);
|
- r = strv_env_assign(&l, "XKBOPTIONS", empty_to_null(xc->options));
|
||||||
- if (!s)
|
- if (r < 0)
|
||||||
- return -ENOMEM;
|
- return r;
|
||||||
-
|
|
||||||
- u = strv_env_set(l, s);
|
|
||||||
- if (!u)
|
|
||||||
- return -ENOMEM;
|
|
||||||
-
|
|
||||||
- strv_free_and_replace(l, u);
|
|
||||||
- }
|
|
||||||
-
|
-
|
||||||
- if (strv_isempty(l)) {
|
- if (strv_isempty(l)) {
|
||||||
- if (unlink("/etc/vconsole.conf") < 0)
|
- if (unlink("/etc/vconsole.conf") < 0)
|
||||||
- return errno == ENOENT ? 0 : -errno;
|
- return errno == ENOENT ? 0 : -errno;
|
||||||
-
|
-
|
||||||
- c->vc_mtime = USEC_INFINITY;
|
- c->vc_stat = (struct stat) {};
|
||||||
- return 0;
|
- return 0;
|
||||||
- }
|
- }
|
||||||
-
|
-
|
||||||
- r = write_env_file_label("/etc/vconsole.conf", l);
|
- r = write_vconsole_conf_label(l);
|
||||||
- if (r < 0)
|
- if (r < 0)
|
||||||
- return r;
|
- return r;
|
||||||
-
|
-
|
||||||
- if (stat("/etc/vconsole.conf", &st) >= 0)
|
- if (stat("/etc/vconsole.conf", &c->vc_stat) < 0)
|
||||||
- c->vc_mtime = timespec_load(&st.st_mtim);
|
- return -errno;
|
||||||
-
|
-
|
||||||
- return 0;
|
- return 0;
|
||||||
+ return -ENOSYS;
|
+ return -ENOSYS;
|
||||||
|
@ -251,72 +214,109 @@ index 6b6b32a591..46aab472b0 100644
|
||||||
|
|
||||||
int x11_write_data(Context *c) {
|
int x11_write_data(Context *c) {
|
||||||
- _cleanup_fclose_ FILE *f = NULL;
|
- _cleanup_fclose_ FILE *f = NULL;
|
||||||
- _cleanup_free_ char *temp_path = NULL;
|
- _cleanup_(unlink_and_freep) char *temp_path = NULL;
|
||||||
- struct stat st;
|
- const X11Context *xc;
|
||||||
- int r;
|
- int r;
|
||||||
-
|
-
|
||||||
- if (isempty(c->x11_layout) &&
|
- assert(c);
|
||||||
- isempty(c->x11_model) &&
|
|
||||||
- isempty(c->x11_variant) &&
|
|
||||||
- isempty(c->x11_options)) {
|
|
||||||
-
|
-
|
||||||
|
- xc = context_get_x11_context(c);
|
||||||
|
- if (x11_context_isempty(xc)) {
|
||||||
- if (unlink("/etc/X11/xorg.conf.d/00-keyboard.conf") < 0)
|
- if (unlink("/etc/X11/xorg.conf.d/00-keyboard.conf") < 0)
|
||||||
- return errno == ENOENT ? 0 : -errno;
|
- return errno == ENOENT ? 0 : -errno;
|
||||||
-
|
-
|
||||||
- c->vc_mtime = USEC_INFINITY;
|
- c->x11_stat = (struct stat) {};
|
||||||
- return 0;
|
- return 0;
|
||||||
- }
|
- }
|
||||||
-
|
-
|
||||||
- mkdir_p_label("/etc/X11/xorg.conf.d", 0755);
|
- (void) mkdir_p_label("/etc/X11/xorg.conf.d", 0755);
|
||||||
-
|
|
||||||
- r = fopen_temporary("/etc/X11/xorg.conf.d/00-keyboard.conf", &f, &temp_path);
|
- r = fopen_temporary("/etc/X11/xorg.conf.d/00-keyboard.conf", &f, &temp_path);
|
||||||
- if (r < 0)
|
- if (r < 0)
|
||||||
- return r;
|
- return r;
|
||||||
-
|
-
|
||||||
- (void) __fsetlocking(f, FSETLOCKING_BYCALLER);
|
|
||||||
- (void) fchmod(fileno(f), 0644);
|
- (void) fchmod(fileno(f), 0644);
|
||||||
-
|
-
|
||||||
- fputs("# Written by systemd-localed(8), read by systemd-localed and Xorg. It's\n"
|
- fputs("# Written by systemd-localed(8), read by systemd-localed and Xorg. It's\n"
|
||||||
- "# probably wise not to edit this file manually. Use localectl(1) to\n"
|
- "# probably wise not to edit this file manually. Use localectl(1) to\n"
|
||||||
- "# instruct systemd-localed to update it.\n"
|
- "# update this file.\n"
|
||||||
- "Section \"InputClass\"\n"
|
- "Section \"InputClass\"\n"
|
||||||
- " Identifier \"system-keyboard\"\n"
|
- " Identifier \"system-keyboard\"\n"
|
||||||
- " MatchIsKeyboard \"on\"\n", f);
|
- " MatchIsKeyboard \"on\"\n", f);
|
||||||
-
|
-
|
||||||
- if (!isempty(c->x11_layout))
|
- if (!isempty(xc->layout))
|
||||||
- fprintf(f, " Option \"XkbLayout\" \"%s\"\n", c->x11_layout);
|
- fprintf(f, " Option \"XkbLayout\" \"%s\"\n", xc->layout);
|
||||||
-
|
-
|
||||||
- if (!isempty(c->x11_model))
|
- if (!isempty(xc->model))
|
||||||
- fprintf(f, " Option \"XkbModel\" \"%s\"\n", c->x11_model);
|
- fprintf(f, " Option \"XkbModel\" \"%s\"\n", xc->model);
|
||||||
-
|
-
|
||||||
- if (!isempty(c->x11_variant))
|
- if (!isempty(xc->variant))
|
||||||
- fprintf(f, " Option \"XkbVariant\" \"%s\"\n", c->x11_variant);
|
- fprintf(f, " Option \"XkbVariant\" \"%s\"\n", xc->variant);
|
||||||
-
|
-
|
||||||
- if (!isempty(c->x11_options))
|
- if (!isempty(xc->options))
|
||||||
- fprintf(f, " Option \"XkbOptions\" \"%s\"\n", c->x11_options);
|
- fprintf(f, " Option \"XkbOptions\" \"%s\"\n", xc->options);
|
||||||
-
|
-
|
||||||
- fputs("EndSection\n", f);
|
- fputs("EndSection\n", f);
|
||||||
-
|
-
|
||||||
- r = fflush_sync_and_check(f);
|
- r = fflush_sync_and_check(f);
|
||||||
- if (r < 0)
|
- if (r < 0)
|
||||||
- goto fail;
|
- return r;
|
||||||
-
|
-
|
||||||
- if (rename(temp_path, "/etc/X11/xorg.conf.d/00-keyboard.conf") < 0) {
|
- if (rename(temp_path, "/etc/X11/xorg.conf.d/00-keyboard.conf") < 0)
|
||||||
- r = -errno;
|
- return -errno;
|
||||||
- goto fail;
|
|
||||||
- }
|
|
||||||
-
|
-
|
||||||
- if (stat("/etc/X11/xorg.conf.d/00-keyboard.conf", &st) >= 0)
|
- if (stat("/etc/X11/xorg.conf.d/00-keyboard.conf", &c->x11_stat) < 0)
|
||||||
- c->x11_mtime = timespec_load(&st.st_mtim);
|
- return -errno;
|
||||||
-
|
-
|
||||||
- return 0;
|
- return 0;
|
||||||
-
|
|
||||||
-fail:
|
|
||||||
- if (temp_path)
|
|
||||||
- (void) unlink(temp_path);
|
|
||||||
-
|
|
||||||
- return r;
|
|
||||||
+ return -ENOSYS;
|
+ return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int read_next_mapping(const char* filename,
|
static int read_next_mapping(
|
||||||
|
diff --git a/src/shared/locale-setup.c b/src/shared/locale-setup.c
|
||||||
|
index 5c4580cfff..b181e24c78 100644
|
||||||
|
--- a/src/shared/locale-setup.c
|
||||||
|
+++ b/src/shared/locale-setup.c
|
||||||
|
@@ -184,42 +184,7 @@ int locale_context_build_env(const LocaleContext *c, char ***ret_set, char ***re
|
||||||
|
}
|
||||||
|
|
||||||
|
int locale_context_save(LocaleContext *c, char ***ret_set, char ***ret_unset) {
|
||||||
|
- _cleanup_strv_free_ char **set = NULL, **unset = NULL;
|
||||||
|
- int r;
|
||||||
|
-
|
||||||
|
- assert(c);
|
||||||
|
-
|
||||||
|
- /* Set values will be returned as strv in *ret on success. */
|
||||||
|
-
|
||||||
|
- r = locale_context_build_env(c, &set, ret_unset ? &unset : NULL);
|
||||||
|
- if (r < 0)
|
||||||
|
- return r;
|
||||||
|
-
|
||||||
|
- if (strv_isempty(set)) {
|
||||||
|
- if (unlink("/etc/locale.conf") < 0)
|
||||||
|
- return errno == ENOENT ? 0 : -errno;
|
||||||
|
-
|
||||||
|
- c->st = (struct stat) {};
|
||||||
|
-
|
||||||
|
- if (ret_set)
|
||||||
|
- *ret_set = NULL;
|
||||||
|
- if (ret_unset)
|
||||||
|
- *ret_unset = NULL;
|
||||||
|
- return 0;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- r = write_env_file_label(AT_FDCWD, "/etc/locale.conf", NULL, set);
|
||||||
|
- if (r < 0)
|
||||||
|
- return r;
|
||||||
|
-
|
||||||
|
- if (stat("/etc/locale.conf", &c->st) < 0)
|
||||||
|
- return -errno;
|
||||||
|
-
|
||||||
|
- if (ret_set)
|
||||||
|
- *ret_set = TAKE_PTR(set);
|
||||||
|
- if (ret_unset)
|
||||||
|
- *ret_unset = TAKE_PTR(unset);
|
||||||
|
- return 0;
|
||||||
|
+ return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
int locale_context_merge(const LocaleContext *c, char *l[_VARIABLE_LC_MAX]) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue