diff options
author | Peter Jones <pjones@redhat.com> | 2005-03-09 06:52:19 +0000 |
---|---|---|
committer | Peter Jones <pjones@redhat.com> | 2005-03-09 06:52:19 +0000 |
commit | 9792c2745116c37e6b6cc87fe642adc7090c76c1 (patch) | |
tree | 221c1f01778cf0fce10629ef19186bd583b587a5 | |
parent | f4c1ed15caf18b5d6853a6df82c1a3e9cc21db93 (diff) | |
download | anaconda-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)
-rw-r--r-- | iutil.py | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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, |