Google
  Web www.spinics.net

[PATCH] Fix mount/unmount for Solaris

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


# HG changeset patch
# User john.levon@xxxxxxx
# Date 1228271149 28800
# Node ID a4538c6c2d6690526d80c011b46b4700c23a9ffd
# Parent  7069ca5b2ced261f19438d3091af89aea2441b88
Fix mount/unmount for Solaris

mount is not portable: fix for Solaris

Signed-off-by: John Levon <john.levon@xxxxxxx>

diff --git a/virtinst/ImageFetcher.py b/virtinst/ImageFetcher.py
--- a/virtinst/ImageFetcher.py
+++ b/virtinst/ImageFetcher.py
@@ -180,14 +180,23 @@ class MountedImageFetcher(LocalImageFetc
     def prepareLocation(self):
         cmd = None
         self.srcdir = tempfile.mkdtemp(prefix="virtinstmnt.", dir=self.scratchdir)
+        mountcmd = "/bin/mount"
+        if os.uname()[0] == "SunOS":
+            mountcmd = "/usr/sbin/mount"
+
         logging.debug("Preparing mount at " + self.srcdir)
         if self.location.startswith("nfs:"):
-            cmd = ["mount", "-o", "ro", self.location[4:], self.srcdir]
+            cmd = [mountcmd, "-o", "ro", self.location[4:], self.srcdir]
         else:
             if stat.S_ISBLK(os.stat(self.location)[stat.ST_MODE]):
-                cmd = ["mount", "-o", "ro", self.location, self.srcdir]
+                mountopt = "ro"
             else:
-                cmd = ["mount", "-o", "ro,loop", self.location, self.srcdir]
+                mountopt = "ro,loop"
+            if os.uname()[0] == 'SunOS':
+                cmd = [mountcmd, "-F", "hsfs", "-o",
+                        mountopt, self.location, self.srcdir]
+            else:
+                cmd = [mountcmd, "-o", mountopt, self.location, self.srcdir]
         ret = subprocess.call(cmd)
         if ret != 0:
             self.cleanupLocation()
@@ -197,7 +206,10 @@ class MountedImageFetcher(LocalImageFetc
 
     def cleanupLocation(self):
         logging.debug("Cleaning up mount at " + self.srcdir)
-        cmd = ["umount", self.srcdir]
+        if os.uname()[0] == "SunOS":
+            cmd = ["/usr/sbin/umount", self.srcdir]
+        else:
+            cmd = ["/bin/umount", self.srcdir]
         subprocess.call(cmd)
         try:
             os.rmdir(self.srcdir)

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Home]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Red Hat 9 Bible]     [Fedora Bible]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

Powered by Linux

Google
  Web www.spinics.net