2020-07-31 17:02:33 +01:00
|
|
|
From 5e235e1f720f37fc5581b40c9a13d365368e74a8 Mon Sep 17 00:00:00 2001
|
2020-01-26 13:56:41 +00:00
|
|
|
From: Nikolay Amiantov <ab@fmap.me>
|
|
|
|
Date: Tue, 11 Oct 2016 13:12:08 +0300
|
2020-04-30 00:03:18 +01:00
|
|
|
Subject: [PATCH 09/18] Change /usr/share/zoneinfo to /etc/zoneinfo
|
2020-01-26 13:56:41 +00:00
|
|
|
|
|
|
|
NixOS uses this path.
|
|
|
|
---
|
|
|
|
man/localtime.xml | 4 ++--
|
|
|
|
src/basic/time-util.c | 6 +++---
|
|
|
|
src/firstboot/firstboot.c | 2 +-
|
2020-03-07 22:47:22 +00:00
|
|
|
src/nspawn/nspawn.c | 4 ++--
|
2020-01-26 13:56:41 +00:00
|
|
|
src/timedate/timedated.c | 8 ++++----
|
2020-03-07 22:47:22 +00:00
|
|
|
5 files changed, 12 insertions(+), 12 deletions(-)
|
2020-01-26 13:56:41 +00:00
|
|
|
|
|
|
|
diff --git a/man/localtime.xml b/man/localtime.xml
|
|
|
|
index 0f1652ee2e..71c4f95c2e 100644
|
|
|
|
--- a/man/localtime.xml
|
|
|
|
+++ b/man/localtime.xml
|
|
|
|
@@ -20,7 +20,7 @@
|
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
<refsynopsisdiv>
|
|
|
|
- <para><filename>/etc/localtime</filename> -> <filename>../usr/share/zoneinfo/…</filename></para>
|
|
|
|
+ <para><filename>/etc/localtime</filename> -> <filename>zoneinfo/…</filename></para>
|
|
|
|
</refsynopsisdiv>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
@@ -30,7 +30,7 @@
|
|
|
|
system-wide timezone of the local system that is used by
|
|
|
|
applications for presentation to the user. It should be an
|
|
|
|
absolute or relative symbolic link pointing to
|
|
|
|
- <filename>/usr/share/zoneinfo/</filename>, followed by a timezone
|
|
|
|
+ <filename>/etc/zoneinfo/</filename>, followed by a timezone
|
|
|
|
identifier such as <literal>Europe/Berlin</literal> or
|
|
|
|
<literal>Etc/UTC</literal>. The resulting link should lead to the
|
|
|
|
corresponding binary
|
|
|
|
diff --git a/src/basic/time-util.c b/src/basic/time-util.c
|
2020-07-31 17:02:33 +01:00
|
|
|
index 15cc1b8851..d0abde5933 100644
|
2020-01-26 13:56:41 +00:00
|
|
|
--- a/src/basic/time-util.c
|
|
|
|
+++ b/src/basic/time-util.c
|
2020-07-31 17:02:33 +01:00
|
|
|
@@ -1259,7 +1259,7 @@ int get_timezones(char ***ret) {
|
2020-01-26 13:56:41 +00:00
|
|
|
n_allocated = 2;
|
|
|
|
n_zones = 1;
|
|
|
|
|
|
|
|
- f = fopen("/usr/share/zoneinfo/zone1970.tab", "re");
|
|
|
|
+ f = fopen("/etc/zoneinfo/zone1970.tab", "re");
|
|
|
|
if (f) {
|
|
|
|
for (;;) {
|
|
|
|
_cleanup_free_ char *line = NULL;
|
2020-07-31 17:02:33 +01:00
|
|
|
@@ -1354,7 +1354,7 @@ bool timezone_is_valid(const char *name, int log_level) {
|
2020-01-26 13:56:41 +00:00
|
|
|
if (p - name >= PATH_MAX)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
- t = strjoina("/usr/share/zoneinfo/", name);
|
|
|
|
+ t = strjoina("/etc/zoneinfo/", name);
|
|
|
|
|
|
|
|
fd = open(t, O_RDONLY|O_CLOEXEC);
|
|
|
|
if (fd < 0) {
|
2020-07-31 17:02:33 +01:00
|
|
|
@@ -1452,7 +1452,7 @@ int get_timezone(char **ret) {
|
2020-01-26 13:56:41 +00:00
|
|
|
if (r < 0)
|
|
|
|
return r; /* returns EINVAL if not a symlink */
|
|
|
|
|
|
|
|
- e = PATH_STARTSWITH_SET(t, "/usr/share/zoneinfo/", "../usr/share/zoneinfo/");
|
|
|
|
+ e = PATH_STARTSWITH_SET(t, "/etc/zoneinfo/", "../etc/zoneinfo/");
|
|
|
|
if (!e)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
|
2020-07-31 17:02:33 +01:00
|
|
|
index a3f442518e..feff49e280 100644
|
2020-01-26 13:56:41 +00:00
|
|
|
--- a/src/firstboot/firstboot.c
|
|
|
|
+++ b/src/firstboot/firstboot.c
|
2020-07-31 17:02:33 +01:00
|
|
|
@@ -459,7 +459,7 @@ static int process_timezone(void) {
|
2020-01-26 13:56:41 +00:00
|
|
|
if (isempty(arg_timezone))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
- e = strjoina("../usr/share/zoneinfo/", arg_timezone);
|
|
|
|
+ e = strjoina("zoneinfo/", arg_timezone);
|
|
|
|
|
|
|
|
(void) mkdir_parents(etc_localtime, 0755);
|
|
|
|
if (symlink(e, etc_localtime) < 0)
|
2020-03-07 22:47:22 +00:00
|
|
|
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
|
2020-07-31 17:02:33 +01:00
|
|
|
index 0117a9939d..d86445b40f 100644
|
2020-03-07 22:47:22 +00:00
|
|
|
--- a/src/nspawn/nspawn.c
|
|
|
|
+++ b/src/nspawn/nspawn.c
|
2020-07-31 17:02:33 +01:00
|
|
|
@@ -1699,8 +1699,8 @@ static int userns_mkdir(const char *root, const char *path, mode_t mode, uid_t u
|
2020-03-07 22:47:22 +00:00
|
|
|
static const char *timezone_from_path(const char *path) {
|
|
|
|
return PATH_STARTSWITH_SET(
|
|
|
|
path,
|
|
|
|
- "../usr/share/zoneinfo/",
|
|
|
|
- "/usr/share/zoneinfo/");
|
|
|
|
+ "../etc/zoneinfo/",
|
|
|
|
+ "/etc/zoneinfo/");
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool etc_writable(void) {
|
2020-01-26 13:56:41 +00:00
|
|
|
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
|
2020-07-31 17:02:33 +01:00
|
|
|
index 3e78b2f575..de5477a08f 100644
|
2020-01-26 13:56:41 +00:00
|
|
|
--- a/src/timedate/timedated.c
|
|
|
|
+++ b/src/timedate/timedated.c
|
2020-07-31 17:02:33 +01:00
|
|
|
@@ -269,7 +269,7 @@ static int context_read_data(Context *c) {
|
2020-01-26 13:56:41 +00:00
|
|
|
|
|
|
|
r = get_timezone(&t);
|
|
|
|
if (r == -EINVAL)
|
|
|
|
- log_warning_errno(r, "/etc/localtime should be a symbolic link to a time zone data file in /usr/share/zoneinfo/.");
|
|
|
|
+ log_warning_errno(r, "/etc/localtime should be a symbolic link to a time zone data file in /etc/zoneinfo/.");
|
|
|
|
else if (r < 0)
|
|
|
|
log_warning_errno(r, "Failed to get target of /etc/localtime: %m");
|
|
|
|
|
2020-07-31 17:02:33 +01:00
|
|
|
@@ -293,7 +293,7 @@ static int context_write_data_timezone(Context *c) {
|
2020-01-26 13:56:41 +00:00
|
|
|
|
|
|
|
if (isempty(c->zone) || streq(c->zone, "UTC")) {
|
|
|
|
|
|
|
|
- if (access("/usr/share/zoneinfo/UTC", F_OK) < 0) {
|
|
|
|
+ if (access("/etc/zoneinfo/UTC", F_OK) < 0) {
|
|
|
|
|
|
|
|
if (unlink("/etc/localtime") < 0 && errno != ENOENT)
|
|
|
|
return -errno;
|
2020-07-31 17:02:33 +01:00
|
|
|
@@ -301,9 +301,9 @@ static int context_write_data_timezone(Context *c) {
|
2020-01-26 13:56:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
- source = "../usr/share/zoneinfo/UTC";
|
2020-03-07 22:47:22 +00:00
|
|
|
+ source = "../etc/zoneinfo/UTC";
|
2020-01-26 13:56:41 +00:00
|
|
|
} else {
|
|
|
|
- p = path_join("../usr/share/zoneinfo", c->zone);
|
2020-03-07 22:47:22 +00:00
|
|
|
+ p = path_join("../etc/zoneinfo", c->zone);
|
2020-01-26 13:56:41 +00:00
|
|
|
if (!p)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
--
|
2020-07-31 17:02:33 +01:00
|
|
|
2.27.0
|
2020-01-26 13:56:41 +00:00
|
|
|
|