vscode-extensions.github.copilot{*}: bump (#364729)
[NixPkgs.git] / pkgs / os-specific / linux / systemd / 0007-Change-usr-share-zoneinfo-to-etc-zoneinfo.patch
blobb73489f56b295012a7ab4dda60cb040aac64adc6
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
6 NixOS uses this path.
7 ---
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
19 @@ -20,7 +20,7 @@
20 </refnamediv>
22 <refsynopsisdiv>
23 - <para><filename>/etc/localtime</filename> -&gt; <filename>../usr/share/zoneinfo/…</filename></para>
24 + <para><filename>/etc/localtime</filename> -&gt; <filename>zoneinfo/…</filename></para>
25 </refsynopsisdiv>
27 <refsect1>
28 @@ -30,7 +30,7 @@
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
36 corresponding binary
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) {
43 assert(ret);
45 - f = fopen("/usr/share/zoneinfo/zone1970.tab", "re");
46 + f = fopen("/etc/zoneinfo/zone1970.tab", "re");
47 if (!f)
48 return -errno;
50 @@ -1453,7 +1453,7 @@ static int get_timezones_from_tzdata_zi(char ***ret) {
52 assert(ret);
54 - f = fopen("/usr/share/zoneinfo/tzdata.zi", "re");
55 + f = fopen("/etc/zoneinfo/tzdata.zi", "re");
56 if (!f)
57 return -errno;
59 @@ -1565,7 +1565,7 @@ int verify_timezone(const char *name, int log_level) {
60 if (p - name >= PATH_MAX)
61 return -ENAMETOOLONG;
63 - t = strjoina("/usr/share/zoneinfo/", name);
64 + t = strjoina("/etc/zoneinfo/", name);
66 fd = open(t, O_RDONLY|O_CLOEXEC);
67 if (fd < 0)
68 @@ -1617,7 +1617,7 @@ int get_timezone(char **ret) {
69 if (r < 0)
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/");
74 if (!e)
75 return -EINVAL;
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))
83 return 0;
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);
89 if (r < 0)
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(
97 path,
98 - "../usr/share/zoneinfo/",
99 - "/usr/share/zoneinfo/");
100 + "../etc/zoneinfo/",
101 + "/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);
112 if (r == -EINVAL)
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/.");
115 else if (r < 0)
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)
126 return -errno;
127 @@ -312,9 +312,9 @@ static int context_write_data_timezone(Context *c) {
128 return 0;
131 - source = "../usr/share/zoneinfo/UTC";
132 + source = "../etc/zoneinfo/UTC";
133 } else {
134 - p = path_join("../usr/share/zoneinfo", c->zone);
135 + p = path_join("../etc/zoneinfo", c->zone);
136 if (!p)
137 return -ENOMEM;