[systemd-devel] [PATCH] timedated: support split usr v3
Shawn Landden
shawn at churchofgit.com
Sun Jan 18 10:53:41 PST 2015
From: Shawn Paul Landden <shawn at churchofgit.com>
The current Debian solution to this is really ugly, and I would rather
have them use the correct patch even if split usr is dumb.
Read: http://rusty.ozlabs.org/?p=236
("Why Everyone Must Oppose The Merging of /usr and /")
(I managed to skip the pulseaudio implamentation mess because I
had a fancy emu10k1 SoundBlaster Live! 5.1 which does its own
hardware mixing.)
v3: revert 99f861310d3f05f4
---
src/timedate/timedated.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 753c3d1..3fbc24e 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -29,6 +29,7 @@
#include "sd-bus.h"
#include "util.h"
+#include "copy.h"
#include "strv.h"
#include "def.h"
#include "clock-util.h"
@@ -95,6 +96,14 @@ static int context_read_data(Context *c) {
}
}
+#ifdef HAVE_SPLIT_USR
+ r = read_one_line_file("/etc/timezone", c->zone);
+ if (r < 0) {
+ if (r != -ENOENT)
+ log_warning("Failed to read /etc/timezone: %s", strerror(-r));
+ }
+#endif
+
have_timezone:
if (isempty(c->zone)) {
free(c->zone);
@@ -123,9 +132,21 @@ static int context_write_data_timezone(Context *c) {
if (!p)
return log_oom();
+#ifdef HAVE_SPLIT_USR
+ r = write_string_file_atomic("/etc/timezone", c->zone);
+ if (r < 0)
+ return r;
+
+ /* "/usr/sha..." */
+ r = copy_file((p + 2), "/etc/localtime", O_TRUNC,
+ S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); /*644*/
+ if (r < 0)
+ return r;
+#else
r = symlink_atomic(p, "/etc/localtime");
if (r < 0)
return r;
+#endif
return 0;
}
--
2.1.4
More information about the systemd-devel
mailing list