[81463] trunk/dports/fuse/fuse4x-kext/Portfile

dports at macports.org dports at macports.org
Sun Jul 31 02:22:37 PDT 2011


Revision: 81463
          http://trac.macports.org/changeset/81463
Author:   dports at macports.org
Date:     2011-07-31 02:22:36 -0700 (Sun, 31 Jul 2011)
Log Message:
-----------
fuse4x-kext: update post-activate logic. If another version of the
kext is currently loaded, attempt to unload it. If that fails, print a
list of filesystems that need to be unmounted. See #30437.

Modified Paths:
--------------
    trunk/dports/fuse/fuse4x-kext/Portfile

Modified: trunk/dports/fuse/fuse4x-kext/Portfile
===================================================================
--- trunk/dports/fuse/fuse4x-kext/Portfile	2011-07-31 09:11:32 UTC (rev 81462)
+++ trunk/dports/fuse/fuse4x-kext/Portfile	2011-07-31 09:22:36 UTC (rev 81463)
@@ -66,13 +66,30 @@
     xinstall -o root -m 4755 ${worksrcpath}/build/${xcode.configuration}/load_fuse4x ${destroot}${kextdir}/fuse4x.kext/Support
 }
 
+# We don't need to load the kext, because the fuse4x library will
+# autoload it when needed. However, if there's an existing version
+# loaded, we'd better unload it because it might be a different
+# version.
+#
+# Thus, check whether the kext is already loaded, and if so attempt to
+# unload it. If that fails, the user probably needs to unmount some
+# running filesystems; print a list.
 post-activate {
-    if {[string length [exec kextstat -lb org.fuse4x.kext.fuse4x]] > 0} {
-        ui_msg "********************************************************"
-        ui_msg "*  fuse4x is already loaded. You may need to restart.  *"
-        ui_msg "*  Alternatively, if feeling adventurous, you can run  *"
-        ui_msg "*  `sudo kextunload -b org.fuse4x.kext.fuse4x`         *"
-        ui_msg "********************************************************"
+    set kextid "org.fuse4x.kext.fuse4x"
+    if {[string length [exec /sbin/kextstat -lb $kextid]] > 0} {
+        ui_msg "Another version of Fuse4X is already loaded. Attempting to unload it."
+        if {![catch {exec /sbin/kextunload -b $kextid}]} {
+            ui_msg "Successfully unloaded the previous installation of Fuse4X"
+        } else {
+            set mounted [exec /sbin/mount -t fuse4x]
+            ui_warn "Unable to unload the existing Fuse4X kernel extension."
+            ui_warn "To complete the upgrade. please unmount the following filesystems "
+            ui_warn "and then run `sudo kextunload -b $kextid`:"
+            foreach line [split $mounted "\n"] {
+                regexp {on (/.*) \(fuse4x} $line -> mountpoint
+                ui_warn "  - $mountpoint"
+            }
+        }
     }
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110731/e0489fc2/attachment.html>


More information about the macports-changes mailing list