diff options
author | Jakob Unterwurzacher | 2021-05-15 18:28:11 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2021-05-15 18:50:20 +0200 |
commit | c33c7aaf0d943ebcca0df14397e6336d7bf008a1 (patch) | |
tree | e04d880774be197fa312910c9f8ae27dfa8912fa | |
parent | 4488b5b93a9fa29bc9a697256346efae7951d4ea (diff) |
Merge package-source.bash & package-static.bash scriptsv2.0-beta4
-rwxr-xr-x | package-release-tarballs.bash | 97 | ||||
-rwxr-xr-x | package-source.bash | 38 | ||||
-rwxr-xr-x | package-static.bash | 29 |
3 files changed, 97 insertions, 67 deletions
diff --git a/package-release-tarballs.bash b/package-release-tarballs.bash new file mode 100755 index 0000000..ac651bf --- /dev/null +++ b/package-release-tarballs.bash @@ -0,0 +1,97 @@ +#!/bin/bash + +set -eu + +cd "$(dirname "$0")" + +SIGNME="" + +# git_archive_extra PREFIX EXTRA1 [EXTRA2 ...] +# +# Call git-archive and add additional files to the tarball. +# Output tarball is called "$PREFIX.tar.gz" and contains one folder +# called "$PREFIX". +git_archive_extra() { + local PREFIX=$1 + shift + # Add files tracked in git + git archive --prefix "$PREFIX/" -o "$PREFIX.tar" HEAD + # Add "extra" files + tar --owner=root --group=root --transform "s!^!$PREFIX/!" --append -f "$PREFIX.tar" "$@" + # Compress + gzip -f "$PREFIX.tar" +} + +package_source() { + local GITVERSION + GITVERSION=$(git describe --tags --dirty) + echo "$GITVERSION" > VERSION + + # Render the manpages and include them in the tarball. This + # avoids a build-dependency to pandoc. + ./Documentation/MANPAGE-render.bash + + # gocryptfs source tarball + local PREFIX_SRC_ONLY=gocryptfs_${GITVERSION}_src + git_archive_extra "$PREFIX_SRC_ONLY" VERSION Documentation/*.1 + + # gocryptfs source + dependencies tarball + go mod vendor + local PREFIX_SRC_DEPS=gocryptfs_${GITVERSION}_src-deps + git_archive_extra "$PREFIX_SRC_DEPS" VERSION Documentation/*.1 vendor + + rm VERSION + rm -R vendor + + echo "Tars created." + SIGNME+=" $PREFIX_SRC_ONLY.tar.gz $PREFIX_SRC_DEPS.tar.gz" +} + +package_static_binary() { + # Compiles the gocryptfs binary and sets $GITVERSION + source build-without-openssl.bash + + if ldd gocryptfs > /dev/null ; then + echo "error: compiled gocryptfs binary is not static" + exit 1 + fi + + # Build man pages gocryptfs.1 & gocryptfs-xray.1 + ./Documentation/MANPAGE-render.bash > /dev/null + + local ARCH + ARCH=$(go env GOARCH) + local OS + OS=$(go env GOOS) + + local TARBALL + TARBALL=gocryptfs_${GITVERSION}_${OS}-static_${ARCH}.tar + local TARGZ + TARGZ=$TARBALL.gz + + tar --owner=root --group=root --create -vf "$TARBALL" gocryptfs + tar --owner=root --group=root --append -vf "$TARBALL" -C gocryptfs-xray gocryptfs-xray + tar --owner=root --group=root --append -vf "$TARBALL" -C Documentation gocryptfs.1 gocryptfs-xray.1 + + gzip -f "$TARBALL" + + echo "Tar created." + SIGNME+=" $TARGZ" +} + +signing_hint() { + local GITVERSION + GITVERSION=$(git describe --tags --dirty) + + echo "Hint for signing:" + echo " for i in gocryptfs_${GITVERSION}_*.tar.gz ; do gpg -u 23A02740 --armor --detach-sig \$i ; done" +} + +if git describe --dirty | grep dirty ; then + echo "Tree is dirty - I will not package this!" + exit 1 +fi + +package_source +package_static_binary +signing_hint diff --git a/package-source.bash b/package-source.bash deleted file mode 100755 index cdd9923..0000000 --- a/package-source.bash +++ /dev/null @@ -1,38 +0,0 @@ -#!/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" HEAD - # Add "extra" files - tar --owner=root --group=root --transform "s!^!$PREFIX/!" --append -f "$PREFIX.tar" "$@" - # Compress - gzip -f "$PREFIX.tar" -} - -cd "$(dirname "$0")" - -GITVERSION=$(git describe --tags --dirty) -echo "$GITVERSION" > VERSION - -# Render the manpages and include them in the tarball. This -# avoids a build-dependency to pandoc. -./Documentation/MANPAGE-render.bash - -# gocryptfs source tarball -PREFIX_SRC_ONLY=gocryptfs_${GITVERSION}_src -git_archive_extra "$PREFIX_SRC_ONLY" VERSION Documentation/*.1 - -# gocryptfs source + dependencies tarball -go mod vendor -PREFIX_SRC_DEPS=gocryptfs_${GITVERSION}_src-deps -git_archive_extra "$PREFIX_SRC_DEPS" VERSION Documentation/*.1 vendor - -rm VERSION - -echo "Tars created." -echo "Hint for signing: gpg -u 23A02740 --armor --detach-sig $PREFIX_SRC_ONLY.tar.gz" -echo " gpg -u 23A02740 --armor --detach-sig $PREFIX_SRC_DEPS.tar.gz" diff --git a/package-static.bash b/package-static.bash deleted file mode 100755 index ce8cecb..0000000 --- a/package-static.bash +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -eu - -cd "$(dirname "$0")" - -# Compiles the gocryptfs binary and sets $GITVERSION -source build-without-openssl.bash - -if ldd gocryptfs > /dev/null ; then - echo "error: compiled gocryptfs binary is not static" - exit 1 -fi - -# Build man pages gocryptfs.1 & gocryptfs-xray.1 -./Documentation/MANPAGE-render.bash > /dev/null - -ARCH=$(go env GOARCH) -OS=$(go env GOOS) - -TARBALL=gocryptfs_${GITVERSION}_${OS}-static_${ARCH}.tar -TARGZ=$TARBALL.gz - -tar --owner=root --group=root --create -vf "$TARBALL" gocryptfs -tar --owner=root --group=root --append -vf "$TARBALL" -C gocryptfs-xray gocryptfs-xray -tar --owner=root --group=root --append -vf "$TARBALL" -C Documentation gocryptfs.1 gocryptfs-xray.1 - -gzip -f "$TARBALL" - -echo "Tar created." -echo "Hint for signing: gpg -u 23A02740 --armor --detach-sig $TARGZ" |