1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Nikolay Amiantov <ab@fmap.me>
3 Date: Tue, 11 Oct 2016 13:12:08 +0300
4 Subject: [PATCH] Change /usr/share/zoneinfo to /etc/zoneinfo
8 man/localtime.xml | 4 ++--
9 src/basic/time-util.c | 8 ++++----
10 src/firstboot/firstboot.c | 2 +-
11 src/nspawn/nspawn.c | 4 ++--
12 src/timedate/timedated.c | 8 ++++----
13 5 files changed, 13 insertions(+), 13 deletions(-)
15 diff --git a/man/localtime.xml b/man/localtime.xml
16 index 3a13e04a27..4fd58068a1 100644
17 --- a/man/localtime.xml
18 +++ b/man/localtime.xml
23 - <para><filename>/etc/localtime</filename> -> <filename>../usr/share/zoneinfo/…</filename></para>
24 + <para><filename>/etc/localtime</filename> -> <filename>zoneinfo/…</filename></para>
29 system-wide timezone of the local system that is used by
30 applications for presentation to the user. It should be an
31 absolute or relative symbolic link pointing to
32 - <filename>/usr/share/zoneinfo/</filename>, followed by a timezone
33 + <filename>/etc/zoneinfo/</filename>, followed by a timezone
34 identifier such as <literal>Europe/Berlin</literal> or
35 <literal>Etc/UTC</literal>. The resulting link should lead to the
37 diff --git a/src/basic/time-util.c b/src/basic/time-util.c
38 index b94f37c31c..48f5a2526b 100644
39 --- a/src/basic/time-util.c
40 +++ b/src/basic/time-util.c
41 @@ -1412,7 +1412,7 @@ static int get_timezones_from_zone1970_tab(char ***ret) {
45 - f = fopen("/usr/share/zoneinfo/zone1970.tab", "re");
46 + f = fopen("/etc/zoneinfo/zone1970.tab", "re");
50 @@ -1453,7 +1453,7 @@ static int get_timezones_from_tzdata_zi(char ***ret) {
54 - f = fopen("/usr/share/zoneinfo/tzdata.zi", "re");
55 + f = fopen("/etc/zoneinfo/tzdata.zi", "re");
59 @@ -1565,7 +1565,7 @@ int verify_timezone(const char *name, int log_level) {
60 if (p - name >= PATH_MAX)
63 - t = strjoina("/usr/share/zoneinfo/", name);
64 + t = strjoina("/etc/zoneinfo/", name);
66 fd = open(t, O_RDONLY|O_CLOEXEC);
68 @@ -1617,7 +1617,7 @@ int get_timezone(char **ret) {
70 return r; /* Return EINVAL if not a symlink */
72 - const char *e = PATH_STARTSWITH_SET(t, "/usr/share/zoneinfo/", "../usr/share/zoneinfo/");
73 + const char *e = PATH_STARTSWITH_SET(t, "/etc/zoneinfo/", "../etc/zoneinfo/");
76 if (!timezone_is_valid(e, LOG_DEBUG))
77 diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c
78 index 6afabef430..c1e3af77e1 100644
79 --- a/src/firstboot/firstboot.c
80 +++ b/src/firstboot/firstboot.c
81 @@ -648,7 +648,7 @@ static int process_timezone(int rfd) {
82 if (isempty(arg_timezone))
85 - e = strjoina("../usr/share/zoneinfo/", arg_timezone);
86 + e = strjoina("zoneinfo/", arg_timezone);
88 r = symlinkat_atomic_full(e, pfd, f, /* make_relative= */ false);
90 diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
91 index 756ce11b1f..436804b3bd 100644
92 --- a/src/nspawn/nspawn.c
93 +++ b/src/nspawn/nspawn.c
94 @@ -1862,8 +1862,8 @@ int userns_mkdir(const char *root, const char *path, mode_t mode, uid_t uid, gid
95 static const char *timezone_from_path(const char *path) {
96 return PATH_STARTSWITH_SET(
98 - "../usr/share/zoneinfo/",
99 - "/usr/share/zoneinfo/");
100 + "../etc/zoneinfo/",
104 static bool etc_writable(void) {
105 diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
106 index 448aa7e94d..2161e09579 100644
107 --- a/src/timedate/timedated.c
108 +++ b/src/timedate/timedated.c
109 @@ -280,7 +280,7 @@ static int context_read_data(Context *c) {
111 r = get_timezone(&t);
113 - log_warning_errno(r, "/etc/localtime should be a symbolic link to a time zone data file in /usr/share/zoneinfo/.");
114 + log_warning_errno(r, "/etc/localtime should be a symbolic link to a time zone data file in /etc/zoneinfo/.");
116 log_warning_errno(r, "Failed to get target of /etc/localtime: %m");
118 @@ -304,7 +304,7 @@ static int context_write_data_timezone(Context *c) {
120 if (isempty(c->zone) || streq(c->zone, "UTC")) {
122 - if (access("/usr/share/zoneinfo/UTC", F_OK) < 0) {
123 + if (access("/etc/zoneinfo/UTC", F_OK) < 0) {
125 if (unlink("/etc/localtime") < 0 && errno != ENOENT)
127 @@ -312,9 +312,9 @@ static int context_write_data_timezone(Context *c) {
131 - source = "../usr/share/zoneinfo/UTC";
132 + source = "../etc/zoneinfo/UTC";
134 - p = path_join("../usr/share/zoneinfo", c->zone);
135 + p = path_join("../etc/zoneinfo", c->zone);