[systemd-devel] [PATCH] timedated: support split usr v2

Shawn Paul Landden shawn at churchofgit.com
Sun Dec 21 23:00:01 PST 2014


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.)

v2: forgot to commit my debugging results before submitting
---
 src/timedate/timedated.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index bf567a1..a2fd781 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -30,6 +30,7 @@
 #include "sd-bus.h"
 
 #include "util.h"
+#include "copy.h"
 #include "strv.h"
 #include "def.h"
 #include "clock-util.h"
@@ -123,9 +124,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.0



More information about the systemd-devel mailing list