summaryrefslogtreecommitdiffstats
path: root/upgrade.py
diff options
context:
space:
mode:
authorMike Fulbright <msf@redhat.com>2001-03-13 15:42:22 +0000
committerMike Fulbright <msf@redhat.com>2001-03-13 15:42:22 +0000
commitd62585166cbd1ae77a72f832428de41ea57501e7 (patch)
tree23ac3029bfb275a85a9ae01f548b27f80d76116e /upgrade.py
parentb46e0587a603f1c7c9e3fb2484ee947c04c8f0b7 (diff)
downloadanaconda-d62585166cbd1ae77a72f832428de41ea57501e7.tar.gz
anaconda-d62585166cbd1ae77a72f832428de41ea57501e7.tar.xz
anaconda-d62585166cbd1ae77a72f832428de41ea57501e7.zip
handle case where symlink exists as well when avoiding files with name like 'SWAP-*' when adding swapfile during upgrade, fixes bug 31251
Diffstat (limited to 'upgrade.py')
-rw-r--r--upgrade.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/upgrade.py b/upgrade.py
index ef10d5909..69a5f6ece 100644
--- a/upgrade.py
+++ b/upgrade.py
@@ -149,6 +149,22 @@ def swapSuggestion(instPath, fstab):
return (fsList, suggestion, suggMnt)
+
+def swapfileExists(swapname):
+
+ if os.access(swapname, os.R_OK):
+ return 1
+
+ exists = 0
+ try:
+ rc = os.lstat(swapname)
+ exists = 1
+ except:
+ pass
+
+ return exists
+
+
def createSwapFile(instPath, theFstab, mntPoint, size, progressWindow):
fstabPath = instPath + "/etc/fstab"
prefix = ""
@@ -158,7 +174,7 @@ def createSwapFile(instPath, theFstab, mntPoint, size, progressWindow):
file = mntPoint + "/SWAP"
count = 0
- while (os.access(instPath + file, os.R_OK)):
+ while (swapfileExists(instPath + file)):
count = count + 1
file = "%s/SWAP-%d" % mntPoint, count