summaryrefslogtreecommitdiffstats
path: root/iutil.py
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>1999-12-11 21:11:09 +0000
committerErik Troan <ewt@redhat.com>1999-12-11 21:11:09 +0000
commit6c57d5c852790a1441cfd6f0039bd1cdee36fcd9 (patch)
tree434bcf3865a9b686f229a43477ad8b5a7decb86c /iutil.py
parent784a328d02c137bad5a09f4aa22d04ce65726fc1 (diff)
downloadanaconda-6c57d5c852790a1441cfd6f0039bd1cdee36fcd9.tar.gz
anaconda-6c57d5c852790a1441cfd6f0039bd1cdee36fcd9.tar.xz
anaconda-6c57d5c852790a1441cfd6f0039bd1cdee36fcd9.zip
1) more fstab-ish updates
2) split text timezone stuff into textw/timezone.py
Diffstat (limited to 'iutil.py')
-rw-r--r--iutil.py41
1 files changed, 40 insertions, 1 deletions
diff --git a/iutil.py b/iutil.py
index bba11315e..a151eee28 100644
--- a/iutil.py
+++ b/iutil.py
@@ -1,5 +1,5 @@
-import types, os, sys, isys, select, string
+import types, os, sys, isys, select, string, stat
def getArch ():
arch = os.uname ()[4]
@@ -168,3 +168,42 @@ def getDefaultRunlevel ():
return fields[1]
return None
+
+def makerelname(relpath, filename):
+ if relpath != '':
+ return relpath+'/'+filename
+ else:
+ return filename
+
+
+def findtz(basepath, relpath):
+ tzdata = []
+ for n in os.listdir(basepath+'/'+relpath):
+ timezone = makerelname(relpath, n)
+ if relpath != '':
+ timezone = relpath+'/'+n
+ else:
+ timezone = n
+
+ filestat = os.lstat(basepath+'/'+timezone)
+ [filemode] = filestat[:1]
+
+ if (not (stat.S_ISLNK(filemode) or
+ stat.S_ISREG(filemode) or
+ stat.S_ISDIR(filemode))):
+ continue
+ elif n[:1] >= 'A' and n[:1] <= 'Z':
+ if stat.S_ISDIR(filemode):
+ tmptzdata = findtz(basepath, timezone)
+ else:
+ tmptzdata = [timezone]
+
+ for m in tmptzdata:
+ if tzdata == []:
+ tzdata = [m]
+ else:
+ tzdata.append(m)
+
+ tzdata.sort()
+
+ return tzdata