summaryrefslogtreecommitdiffstats
path: root/packages.py
diff options
context:
space:
mode:
authorAles Kozumplik <akozumpl@redhat.com>2009-12-02 16:42:43 +0100
committerAles Kozumplik <akozumpl@redhat.com>2009-12-03 11:30:43 +0100
commit9edbc30c4548ac894be84bf8cdec651e240fc173 (patch)
tree7902e9fd046ba8a176f6b6d6479bcbf56e73f93c /packages.py
parent7e3fe161c4b600b10abe6796be5b81db9682a953 (diff)
downloadanaconda-9edbc30c4548ac894be84bf8cdec651e240fc173.tar.gz
anaconda-9edbc30c4548ac894be84bf8cdec651e240fc173.tar.xz
anaconda-9edbc30c4548ac894be84bf8cdec651e240fc173.zip
Remove /etc/localtime before trying to copy into it (#533240).
If the file is already linked with the source the raised inspection kills anaconda. This happens in some unclear livecd situations but in general nothing prevents the user or any software he runs on the livecd from arranging this manually. Tested when the file doesn't exist beforehand (the common scenario) and when the file links to its later origin already (the bug scenario).
Diffstat (limited to 'packages.py')
-rw-r--r--packages.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages.py b/packages.py
index 87028a8fc..0a4951d1c 100644
--- a/packages.py
+++ b/packages.py
@@ -197,11 +197,16 @@ def setupTimezone(anaconda):
os.environ["TZ"] = anaconda.id.timezone.tz
tzfile = "/usr/share/zoneinfo/" + anaconda.id.timezone.tz
+ tzlocalfile = "/etc/localtime"
if not os.access(tzfile, os.R_OK):
log.error("unable to set timezone")
else:
try:
- shutil.copyfile(tzfile, "/etc/localtime")
+ os.remove(tzlocalfile)
+ except OSError:
+ pass
+ try:
+ shutil.copyfile(tzfile, tzlocalfile)
except OSError as e:
log.error("Error copying timezone (from %s): %s" %(tzfile, e.strerror))