summaryrefslogtreecommitdiffstats
path: root/pyanaconda
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2012-08-27 16:45:02 -0700
committerJesse Keating <jkeating@redhat.com>2012-08-27 20:32:16 -0700
commit13df9923e5bc0d4932e31ec207a504d708c490ba (patch)
tree4469d1f119d829ed56aa28b52244a8d9da9e76fb /pyanaconda
parent30e56b9508e717c67db7a88e55366077aeb979ea (diff)
downloadanaconda-13df9923e5bc0d4932e31ec207a504d708c490ba.tar.gz
anaconda-13df9923e5bc0d4932e31ec207a504d708c490ba.tar.xz
anaconda-13df9923e5bc0d4932e31ec207a504d708c490ba.zip
Add a method to determine if device is mounted
This will return a list of places a particular device might be mounted.
Diffstat (limited to 'pyanaconda')
-rw-r--r--pyanaconda/packaging/__init__.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index 7c9b6a1d8..d693bbc12 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -93,6 +93,21 @@ class DependencyError(PayloadError):
class PayloadInstallError(PayloadError):
pass
+def get_mount_paths(dev):
+ mounts = open("/proc/mounts").readlines()
+ mount_paths = []
+ for mount in mounts:
+ try:
+ (device, path, rest) = mount.split(None, 2)
+ except ValueError:
+ continue
+
+ if dev == device:
+ mount_paths.append(path)
+
+ if mount_paths:
+ log.debug("%s is mounted on %s" % (dev, ', '.join(mount_paths)))
+ return mount_paths
def get_mount_device(mountpoint):
import re