source: trunk/dports/fuse/fuse4x-kext/Portfile @ 81463

Last change on this file since 81463 was 81463, checked in by dports@…, 9 years ago

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.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.1 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 81463 2011-07-31 09:22:36Z dports@macports.org $
3
4PortSystem          1.0
5PortGroup           xcode 1.0
6
7name                fuse4x-kext
8version             0.8.8
9set tag             [string map {. _ } $version]
10categories          fuse devel
11platforms           macosx
12maintainers         dports
13description         A kernel extension for Fuse4X
14
15long_description    Fuse4X implements a mechanism that makes it          \
16                    possible to implement a fully functional file        \
17                    system in a user-space program on Mac OS X. It       \
18                    aims to be API-compliant with the FUSE               \
19                    (File-system in USErspace) mechanism that            \
20                    originated on Linux.  Therefore, many existing       \
21                    FUSE file systems become readily usable on Mac OS    \
22                    X. This port provides the dynamically loadable       \
23                    kernel extension at the core of Fuse4X.
24
25homepage            http://fuse4x.org/
26license             BSD
27master_sites        https://github.com/fuse4x/kext/tarball/fuse4x_${tag}
28
29checksums           sha1    9a205c0d63b838c5b45844dedcf881bf4fdfc787 \
30                    rmd160  e849a8a7dc3533760833547e96a796cf7a6609f6
31
32extract.mkdir       yes
33extract.post_args   "| tar --strip-components=1 -xf -"
34
35# This port installs a kernel module, so it must be built for the same
36# architecture as the kernel. We don't have a way to get that;
37# build_arch is the userland architecture, which may be different
38# (e.g. 64-bit userland with 32-bit kernel). So build a universal
39# binary by default.
40default_variants    +universal
41
42# kext destination: kext will be installed into ${kextdir}/fuse4x.kext.
43#
44# The kext is autoloaded by the library using load_fuse4x, so it
45# doesn't have to go into /System/Library/Extensions. It doesn't
46# matter where we put it, as long as it's kept in sync with the library.
47#
48# If updating the patchfile or ${kextdir}, must also update the
49# corresponding patch in the fuse4x port!
50patchfiles          patch-common_fuse_param.h.diff
51set kextdir        "${prefix}/Library/Extensions"
52post-patch {
53    reinplace "s|@@KEXTPATH@@|${kextdir}/fuse4x.kext|" ${worksrcpath}/common/fuse_param.h
54}
55
56xcode.configuration Release
57
58destroot.asroot     yes
59
60destroot {
61    xinstall -d ${destroot}${kextdir}
62    file copy ${worksrcpath}/build/${xcode.configuration}/fuse4x.kext ${destroot}${kextdir}
63    file attributes ${destroot}${kextdir}/fuse4x.kext -owner root -group wheel -permissions rwxr-xr-x
64
65    xinstall -d ${destroot}${kextdir}/fuse4x.kext/Support
66    xinstall -o root -m 4755 ${worksrcpath}/build/${xcode.configuration}/load_fuse4x ${destroot}${kextdir}/fuse4x.kext/Support
67}
68
69# We don't need to load the kext, because the fuse4x library will
70# autoload it when needed. However, if there's an existing version
71# loaded, we'd better unload it because it might be a different
72# version.
73#
74# Thus, check whether the kext is already loaded, and if so attempt to
75# unload it. If that fails, the user probably needs to unmount some
76# running filesystems; print a list.
77post-activate {
78    set kextid "org.fuse4x.kext.fuse4x"
79    if {[string length [exec /sbin/kextstat -lb $kextid]] > 0} {
80        ui_msg "Another version of Fuse4X is already loaded. Attempting to unload it."
81        if {![catch {exec /sbin/kextunload -b $kextid}]} {
82            ui_msg "Successfully unloaded the previous installation of Fuse4X"
83        } else {
84            set mounted [exec /sbin/mount -t fuse4x]
85            ui_warn "Unable to unload the existing Fuse4X kernel extension."
86            ui_warn "To complete the upgrade. please unmount the following filesystems "
87            ui_warn "and then run `sudo kextunload -b $kextid`:"
88            foreach line [split $mounted "\n"] {
89                regexp {on (/.*) \(fuse4x} $line -> mountpoint
90                ui_warn "  - $mountpoint"
91            }
92        }
93    }
94}
95
96livecheck.type      regex
97livecheck.url       ${homepage}
98livecheck.regex     {Fuse4X-([0-9.]+).pkg}
Note: See TracBrowser for help on using the repository browser.