libgocryptfs/build.bash
Jakob Unterwurzacher 3a9bd92754 xray: add "gocryptfs-xray", on-disk-format exploration tool
Example output for a file encrypted in reverse mode:

Header: Version: 2, Id: 0b7f5e2574e4afa859a9bb156a2e7772
Block  0: IV: 0b7f5e2574e4afa859a9bb156a2e7773, Tag: bf39279ac6b1ccd852567aaf26ee386b, Len: 4128
Block  1: IV: 0b7f5e2574e4afa859a9bb156a2e7774, Tag: a4f0f9cde7f70a752254aa8fe7718699, Len: 4128
Block  2: IV: 0b7f5e2574e4afa859a9bb156a2e7775, Tag: b467b153016fc1d531818b65ab9e24f6, Len: 4128
Block  3: IV: 0b7f5e2574e4afa859a9bb156a2e7776, Tag: 1fcb7ffd8f1816fbe807df8148718a5c, Len: 4128
Block  4: IV: 0b7f5e2574e4afa859a9bb156a2e7777, Tag: a217e7933ef434c9f03ad931bb5fde9b, Len: 4128
Block  5: IV: 0b7f5e2574e4afa859a9bb156a2e7778, Tag: f3e6240d75cd66371a0b301111d6f1fc, Len: 4128
Block  6: IV: 0b7f5e2574e4afa859a9bb156a2e7779, Tag: bc85d322ebc7761ae5ef114ea3903a56, Len: 4128
Block  7: IV: 0b7f5e2574e4afa859a9bb156a2e777a, Tag: efda01c6b794690f939a12d6d49ac3af, Len: 4128
Block  8: IV: 0b7f5e2574e4afa859a9bb156a2e777b, Tag: b198329d489d1392080f710206932ff0, Len: 2907
2016-09-25 16:43:17 +02:00

49 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -eu
cd "$(dirname "$0")"
# GOPATH may contain multiple paths separated by ":"
GOPATH2=$(echo $GOPATH | cut -f1 -d:)
# gocryptfs version according to git
GITVERSION=$(git describe --tags --dirty)
# go-fuse version according to git
GITVERSIONFUSE=$(
cd $GOPATH2/src/github.com/hanwen/go-fuse
SHORT=$(git rev-parse --short HEAD)
# Check if the tree is dirty, adapted from
# http://stackoverflow.com/a/2659808/1380267
if ! git diff-index --quiet HEAD; then
echo $SHORT-dirty
else
echo $SHORT
fi
)
# Build Unix timestamp, something like 1467554204.
BUILDTIME=$(date +%s)
# Make sure we have the go binary
go version > /dev/null
# "go version go1.6.2 linux/amd64" -> "1.6"
V=$(go version | cut -d" " -f3 | cut -c3-5)
if [ $V == "1.3" -o $V == "1.4" ]
then
go build -ldflags="-X main.GitVersion $GITVERSION -X main.GitVersionFuse $GITVERSIONFUSE -X main.BuildTime $BUILDTIME"
else
# Go 1.5 wants an "=" here
go build -ldflags="-X main.GitVersion=$GITVERSION -X main.GitVersionFuse=$GITVERSIONFUSE -X main.BuildTime=$BUILDTIME"
fi
(cd gocryptfs-xray; go build)
./gocryptfs -version
mkdir -p $GOPATH2/bin
cp -af gocryptfs $GOPATH2/bin