summaryrefslogtreecommitdiffstats
path: root/iutil.py
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2005-03-09 06:52:19 +0000
committerPeter Jones <pjones@redhat.com>2005-03-09 06:52:19 +0000
commit9792c2745116c37e6b6cc87fe642adc7090c76c1 (patch)
tree221c1f01778cf0fce10629ef19186bd583b587a5 /iutil.py
parentf4c1ed15caf18b5d6853a6df82c1a3e9cc21db93 (diff)
downloadanaconda-9792c2745116c37e6b6cc87fe642adc7090c76c1.tar.gz
anaconda-9792c2745116c37e6b6cc87fe642adc7090c76c1.tar.xz
anaconda-9792c2745116c37e6b6cc87fe642adc7090c76c1.zip
I will not rely on line numbers in /proc/meminfo.
I will not rely on line numbers in /proc/meminfo. I will not rely on line numbers in /proc/meminfo. (fix swap detection during upgrade)
Diffstat (limited to 'iutil.py')
-rw-r--r--iutil.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/iutil.py b/iutil.py
index 9254fd168..7711ade05 100644
--- a/iutil.py
+++ b/iutil.py
@@ -397,13 +397,14 @@ esac
def swapAmount():
f = open("/proc/meminfo", "r")
- mem = f.readlines()[2]
- del f
-
- fields = string.split(mem)
- mem = int(long (fields[1]) / 1024)
+ lines = f.readlines()
+ f.close()
- return mem
+ for l in lines:
+ if l.startswith("SwapTotal:"):
+ fields = string.split(l)
+ return int(fields[1])
+ return 0
def copyDeviceNode(src, dest):
"""Copies the device node at src to dest by looking at the type of device,