[glibc] - Work around RPM dropping the contents of /etc/localtime when it turns into a symlink with %p

Jeffrey Law law at fedoraproject.org
Fri May 25 21:16:53 UTC 2012


commit 66109710962110d73b7e2eaf2e10e834e1fcfd1a
Author: Jeff Law <law at redhat.com>
Date:   Fri May 25 15:16:21 2012 -0600

      - Work around RPM dropping the contents of /etc/localtime
        when it turns into a symlink with %post common script (#825159).

 glibc.spec |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/glibc.spec b/glibc.spec
index 5e11b5e..a837836 100644
--- a/glibc.spec
+++ b/glibc.spec
@@ -28,7 +28,7 @@
 Summary: The GNU libc libraries
 Name: glibc
 Version: %{glibcversion}
-Release: 2%{?dist}
+Release: 3%{?dist}
 # GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries.
 # Things that are linked directly into dynamically linked programs
 # and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional
@@ -1068,6 +1068,25 @@ if posix.access("/etc/ld.so.cache") then
   end
 end
 
+fd = io.open("/etc/sysconfig/clock")
+if not fd then return end
+zonename = nil
+for l in fd:lines() do
+  zone = string.match(l, "^[ \t]*ZONE[ \t]*=[ \t]*\"?([^ \t\n\"]*)");
+  if zone then
+    zonename = "/usr/share/zoneinfo/" .. zone
+    break
+  end
+end
+fd:close()
+if not zonename then return end
+posix.symlink (zonename, "/etc/localtime.tzupdate")
+posix.chmod("/etc/localtime.tzupdate", 0644)
+if not os.rename("/etc/localtime.tzupdate", "/etc/localtime") then
+  os.remove("/etc/localtime.tzupdate")
+end
+
+
 %triggerin common -p <lua> -- tzdata
 function update (filename, new_data)
   local fd = io.open(filename)
@@ -1271,6 +1290,10 @@ rm -f *.filelist*
 %endif
 
 %changelog
+* Fri May 25 2012  Jeff Law <law at redhat.com> - 2.15.90-3
+  - Work around RPM dropping the contents of /etc/localtime
+    when it turns into a symlink with %post common script (#825159).
+
 * Wed May 23 2012  Jeff Law <law at redhat.com> - 2.15.90-2
   - Fix option rotate when one IPV6 server is enabled (#804630)
   - Reenable slow/uberslow path taps slowpow/slowexp.


More information about the scm-commits mailing list