imgcreate/kickstart.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
New commits: commit 7d0753cecdaa9ca3e55325eac3a2b825944377ca Author: Brian C. Lane bcl@redhat.com Date: Wed Jan 16 12:18:34 2013 -0800
default to symlink for /etc/localtime (#885246)
If it doesn't exist use a symlink.
diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py index 809b694..fe0c711 100644 --- a/imgcreate/kickstart.py +++ b/imgcreate/kickstart.py @@ -150,17 +150,20 @@ class TimezoneConfig(KickstartConfig): utc = str(kstimezone.isUtc)
# /etc/localtime is a symlink with glibc > 2.15-41 - if os.path.islink(self.path("/etc/localtime")): - os.unlink(self.path("/etc/localtime")) - os.symlink("/usr/share/zoneinfo/%s" %(tz,), - self.path("/etc/localtime")) - else: + # but if it exists as a file keep it as a file and fall back + # to a symlink. + localtime = self.path("/etc/localtime") + if os.path.isfile(localtime) and \ + not os.path.islink(localtime): try: shutil.copy2(self.path("/usr/share/zoneinfo/%s" %(tz,)), - self.path("/etc/localtime")) + localtime) except (OSError, shutil.Error) as e: logging.error("Error copying timezone: %s" %(e.strerror,)) - + else: + if os.path.exists(localtime): + os.unlink(localtime) + os.symlink("/usr/share/zoneinfo/%s" %(tz,), localtime)
class AuthConfig(KickstartConfig): """A class to apply a kickstart authconfig configuration to a system."""
livecd@lists.fedoraproject.org