summary refs log tree commit diff
path: root/pkgs/os-specific/linux/systemd/0012-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch
blob: 0b14eb7a58ba6e02ee0a3286fbaa7de7f0771a85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
From 76f3fba3031d74647855ce0da2d4e317016cb7d6 Mon Sep 17 00:00:00 2001
From: Nikolay Amiantov <ab@fmap.me>
Date: Tue, 11 Oct 2016 13:12:08 +0300
Subject: [PATCH 12/27] Change /usr/share/zoneinfo to /etc/zoneinfo

NixOS uses this path.
---
 man/localtime.xml         | 4 ++--
 src/basic/time-util.c     | 6 +++---
 src/firstboot/firstboot.c | 2 +-
 src/timedate/timedated.c  | 8 ++++----
 4 files changed, 10 insertions(+), 10 deletions(-)

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> -&gt; <filename>../usr/share/zoneinfo/…</filename></para>
+    <para><filename>/etc/localtime</filename> -&gt; <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
index e14ae8f2f7..a8a3488be1 100644
--- a/src/basic/time-util.c
+++ b/src/basic/time-util.c
@@ -1215,7 +1215,7 @@ int get_timezones(char ***ret) {
         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;
@@ -1310,7 +1310,7 @@ bool timezone_is_valid(const char *name, int log_level) {
         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) {
@@ -1408,7 +1408,7 @@ int get_timezone(char **ret) {
         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
index 528e6452cf..c712ca9072 100644
--- a/src/firstboot/firstboot.c
+++ b/src/firstboot/firstboot.c
@@ -443,7 +443,7 @@ static int process_timezone(void) {
         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)
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index fa20d22cde..8e6dbe1efb 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -265,7 +265,7 @@ static int context_read_data(Context *c) {
 
         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");
 
@@ -289,7 +289,7 @@ static int context_write_data_timezone(Context *c) {
 
         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;
@@ -297,9 +297,9 @@ static int context_write_data_timezone(Context *c) {
                         return 0;
                 }
 
-                source = "../usr/share/zoneinfo/UTC";
+                source = "zoneinfo/UTC";
         } else {
-                p = path_join("../usr/share/zoneinfo", c->zone);
+                p = path_join("zoneinfo", c->zone);
                 if (!p)
                         return -ENOMEM;
 
-- 
2.24.1