main: drop "on-disk format" from -version output, add Go version

As v0.4 introduced ext4-style feature flags, the on-disk format version
is unlinkely to change. Drop it from the version output to reduce
clutter. Use "gocryptfs -version -debug" to see it.

Add the Go version string because only Go 1.6 and newer have an optimized
AES-GCM implementation. This will help users to understand the performance
of their build.
This commit is contained in:
Jakob Unterwurzacher 2016-06-19 19:33:15 +02:00
parent dba221d408
commit 1dcafb99ff
3 changed files with 8 additions and 4 deletions

View File

@ -125,7 +125,10 @@ option.
mounting but makes the password susceptible to brute-force attacks (default 16) mounting but makes the password susceptible to brute-force attacks (default 16)
**-version** **-version**
: Print version and exit : Print version and exit. The output contains three fields seperated by
";". Example: "gocryptfs v0.12-2; go-fuse a4c968c; go1.6.2".
Field 1 is the gocryptfs version, field 2 is the version of the go-fuse
library, field 3 is the Go version that was used to compile the binary.
**-wpanic** **-wpanic**
: When encountering a warning, panic and exit immediately. This is : When encountering a warning, panic and exit immediately. This is

View File

@ -12,7 +12,7 @@ GITVERSIONFUSE=$(cd $GOPATH/src/github.com/hanwen/go-fuse && git rev-parse --sho
# Make sure we have the go binary # Make sure we have the go binary
go version > /dev/null go version > /dev/null
# go version go1.5.1 linux/amd64 # "go version go1.6.2 linux/amd64" -> "1.6"
V=$(go version | cut -d" " -f3 | cut -c3-5) V=$(go version | cut -d" " -f3 | cut -c3-5)
if [ $V == "1.3" -o $V == "1.4" ] if [ $V == "1.3" -o $V == "1.4" ]

View File

@ -151,8 +151,8 @@ func changePassword(args *argContainer) {
// printVersion - print a version string like // printVersion - print a version string like
// "gocryptfs v0.3.1-31-g6736212-dirty; on-disk format 2" // "gocryptfs v0.3.1-31-g6736212-dirty; on-disk format 2"
func printVersion() { func printVersion() {
fmt.Printf("%s %s; on-disk format %d; go-fuse %s\n", fmt.Printf("%s %s; go-fuse %s; %s\n",
tlog.ProgramName, GitVersion, contentenc.CurrentVersion, GitVersionFuse) tlog.ProgramName, GitVersion, GitVersionFuse, runtime.Version())
} }
func main() { func main() {
@ -218,6 +218,7 @@ func main() {
// "-v" // "-v"
if args.version { if args.version {
tlog.Debug.Printf("openssl=%v\n", args.openssl) tlog.Debug.Printf("openssl=%v\n", args.openssl)
tlog.Debug.Printf("on-disk format %d\n", contentenc.CurrentVersion)
printVersion() printVersion()
os.Exit(0) os.Exit(0)
} }