Specify a volname for osxfuse

If I use gocryptfs cypher plain then the resulting volume
should be named 'plain' just as it would be on Linux.
This commit is contained in:
Jeff Kriske 2017-03-26 15:09:54 -04:00 committed by Jakob Unterwurzacher
parent b6bda01c33
commit 9f8e19b856

View File

@ -8,6 +8,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"os/signal" "os/signal"
"path"
"path/filepath" "path/filepath"
"runtime" "runtime"
"strings" "strings"
@ -314,6 +315,13 @@ func initFuseFrontend(key []byte, args *argContainer, confFile *configfile.ConfF
if args.reverse { if args.reverse {
mOpts.Name += "-reverse" mOpts.Name += "-reverse"
} }
// Add a volume name if running osxfuse. Otherwise the Finder will show it as
// something like "osxfuse Volume 0 (gocryptfs)".
if runtime.GOOS == "darwin" {
mOpts.Options = append(mOpts.Options, "volname="+path.Base(args.mountpoint))
}
// The kernel enforces read-only operation, we just have to pass "ro". // The kernel enforces read-only operation, we just have to pass "ro".
// Reverse mounts are always read-only. // Reverse mounts are always read-only.
if args.ro || args.reverse { if args.ro || args.reverse {