Don't allow configurability for osxfuse paths.
There's no need to complicate the API. If osxfuse makes a backwards-incompatible change again, we can add support for it.geesefs-0-30-9
parent
eadfaa0742
commit
fc5bd98d65
|
@ -135,14 +135,6 @@ type MountConfig struct {
|
||||||
// default name involving the string 'osxfuse' is used.
|
// default name involving the string 'osxfuse' is used.
|
||||||
VolumeName string
|
VolumeName string
|
||||||
|
|
||||||
// OS X only.
|
|
||||||
//
|
|
||||||
// OSXFUSELocations sets where to look for OSXFUSE files. The arguments are
|
|
||||||
// all the possible locations. The previous locations are replaced.
|
|
||||||
//
|
|
||||||
// Without this option, OSXFUSELocationV3 and OSXFUSELocationV2 are used.
|
|
||||||
OSXFUSELocations []OSXFUSEPaths
|
|
||||||
|
|
||||||
// Additional key=value options to pass unadulterated to the underlying mount
|
// Additional key=value options to pass unadulterated to the underlying mount
|
||||||
// command. See `man 8 mount`, the fuse documentation, etc. for
|
// command. See `man 8 mount`, the fuse documentation, etc. for
|
||||||
// system-specific information.
|
// system-specific information.
|
||||||
|
@ -258,18 +250,22 @@ type OSXFUSEPaths struct {
|
||||||
DaemonVar string
|
DaemonVar string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default paths for OSXFUSE. See OSXFUSELocations.
|
|
||||||
var (
|
var (
|
||||||
OSXFUSELocationV3 = OSXFUSEPaths{
|
osxfuseLocations = []OSXFUSEPaths{
|
||||||
DevicePrefix: "/dev/osxfuse",
|
// v3
|
||||||
Load: "/Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse",
|
{
|
||||||
Mount: "/Library/Filesystems/osxfuse.fs/Contents/Resources/mount_osxfuse",
|
DevicePrefix: "/dev/osxfuse",
|
||||||
DaemonVar: "MOUNT_OSXFUSE_DAEMON_PATH",
|
Load: "/Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse",
|
||||||
}
|
Mount: "/Library/Filesystems/osxfuse.fs/Contents/Resources/mount_osxfuse",
|
||||||
OSXFUSELocationV2 = OSXFUSEPaths{
|
DaemonVar: "MOUNT_OSXFUSE_DAEMON_PATH",
|
||||||
DevicePrefix: "/dev/osxfuse",
|
},
|
||||||
Load: "/Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs",
|
|
||||||
Mount: "/Library/Filesystems/osxfusefs.fs/Support/mount_osxfusefs",
|
// v2
|
||||||
DaemonVar: "MOUNT_FUSEFS_DAEMON_PATH",
|
{
|
||||||
|
DevicePrefix: "/dev/osxfuse",
|
||||||
|
Load: "/Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs",
|
||||||
|
Mount: "/Library/Filesystems/osxfusefs.fs/Support/mount_osxfusefs",
|
||||||
|
DaemonVar: "MOUNT_FUSEFS_DAEMON_PATH",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,9 +17,7 @@ var errNoAvail = errors.New("no available fuse devices")
|
||||||
var errNotLoaded = errors.New("osxfuse is not loaded")
|
var errNotLoaded = errors.New("osxfuse is not loaded")
|
||||||
|
|
||||||
// errOSXFUSENotFound is returned from Mount when the OSXFUSE installation is
|
// errOSXFUSENotFound is returned from Mount when the OSXFUSE installation is
|
||||||
// not detected.
|
// not detected. Make sure OSXFUSE is installed.
|
||||||
//
|
|
||||||
// Make sure OSXFUSE is installed, or see OSXFUSELocations for customization.
|
|
||||||
var errOSXFUSENotFound = errors.New("cannot locate OSXFUSE")
|
var errOSXFUSENotFound = errors.New("cannot locate OSXFUSE")
|
||||||
|
|
||||||
func loadOSXFUSE(bin string) error {
|
func loadOSXFUSE(bin string) error {
|
||||||
|
@ -136,16 +134,8 @@ func mount(
|
||||||
dir string,
|
dir string,
|
||||||
cfg *MountConfig,
|
cfg *MountConfig,
|
||||||
ready chan<- error) (dev *os.File, err error) {
|
ready chan<- error) (dev *os.File, err error) {
|
||||||
// get OSXFUSE locations
|
// Find the version of osxfuse installed on this machine.
|
||||||
locations := cfg.OSXFUSELocations
|
for _, loc := range osxfuseLocations {
|
||||||
if locations == nil {
|
|
||||||
locations = []OSXFUSEPaths{
|
|
||||||
OSXFUSELocationV3,
|
|
||||||
OSXFUSELocationV2,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, loc := range locations {
|
|
||||||
if _, err := os.Stat(loc.Mount); os.IsNotExist(err) {
|
if _, err := os.Stat(loc.Mount); os.IsNotExist(err) {
|
||||||
// try the other locations
|
// try the other locations
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue