Modified: trunk/dports/fuse/fuse4x-kext/Portfile (81462 => 81463)
--- 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"
+ }
+ }
}
}