summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-11-01 18:58:10 +0100
committerJakob Unterwurzacher2017-11-01 18:58:10 +0100
commit39839ade70035de32084a170faac2a93a771db38 (patch)
tree9a78a091eba530cecb1daf8ac73f9f6ad6109b30
parent9a3791fbc1e3422f06bdd3b63868aa28c04267c3 (diff)
Add source packaging script
-rwxr-xr-xbuild.bash7
-rwxr-xr-xpackage-source.bash25
2 files changed, 32 insertions, 0 deletions
diff --git a/build.bash b/build.bash
index b69f447..fa036ae 100755
--- a/build.bash
+++ b/build.bash
@@ -16,6 +16,13 @@ go version > /dev/null
# GOPATH may contain multiple paths separated by ":"
GOPATH1=$(go env GOPATH | cut -f1 -d:)
+if [[ $PWD != *"/src/github.com/rfjakob/gocryptfs" ]] ; then
+ echo "Warning: Building outside of GOPATH will most likely fail."
+ echo " Please rename $PWD to $GOPATH1/src/github.com/rfjakob/gocryptfs ."
+ sleep 5
+ echo
+fi
+
# gocryptfs version according to git or a VERSION file
if [[ -d .git ]] ; then
GITVERSION=$(git describe --tags --dirty)
diff --git a/package-source.bash b/package-source.bash
new file mode 100755
index 0000000..31fe98c
--- /dev/null
+++ b/package-source.bash
@@ -0,0 +1,25 @@
+#!/bin/bash -eu
+
+# git_archive_extra PREFIX EXTRA1 [EXTRA2 ...]
+# Call git-archive and add additional files to the tarball.
+git_archive_extra() {
+ local PREFIX=$1
+ shift
+ # Add files tracked in git
+ git archive --prefix "$PREFIX/" -o $PREFIX.tar master
+ # Add "extra" files
+ tar --transform "s!^!$PREFIX/!" --append -f $PREFIX.tar "$@"
+ # Compress
+ gzip -f $PREFIX.tar
+}
+
+cd "$(dirname "$0")"
+
+GITVERSION=$(git describe --tags --dirty)
+PREFIX=gocryptfs_${GITVERSION}_src+deps
+
+dep ensure
+git_archive_extra $PREFIX VERSION vendor
+
+echo "Tar created."
+echo "Hint for signing: gpg -u 23A02740 --armor --detach-sig $PREFIX.tar.gz"