aboutsummaryrefslogtreecommitdiff
path: root/build-source.sh
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2020-11-08 12:07:17 -0800
committerMicah Lee <micah@micahflee.com>2020-11-08 12:07:17 -0800
commit46a9434fbfa14b4545f7f5f12f3bd3a2cc3621c9 (patch)
tree064af592ca9e469488f67ff255879c4dbf3ead9f /build-source.sh
parentf319de1d7a833e38e190ef07072aee16e322c6fc (diff)
downloadonionshare-46a9434fbfa14b4545f7f5f12f3bd3a2cc3621c9.tar.gz
onionshare-46a9434fbfa14b4545f7f5f12f3bd3a2cc3621c9.zip
Add incomplete flatpak manifest, update release docs, re-add source package script
Diffstat (limited to 'build-source.sh')
-rwxr-xr-xbuild-source.sh78
1 files changed, 78 insertions, 0 deletions
diff --git a/build-source.sh b/build-source.sh
new file mode 100755
index 00000000..b7bd700a
--- /dev/null
+++ b/build-source.sh
@@ -0,0 +1,78 @@
+#!/bin/bash
+
+# The script builds a source package
+
+# Usage
+display_usage() {
+ echo "Usage: $0 [tag]"
+}
+
+if [ $# -lt 1 ]
+then
+ display_usage
+ exit 1
+fi
+
+# Input validation
+TAG=$1
+
+if [ "${TAG:0:1}" != "v" ]
+then
+ echo "Tag must start with 'v' character"
+ exit 1
+fi
+
+VERSION=${TAG:1}
+
+# Make sure tag exists
+git tag | grep "^$TAG\$"
+if [ $? -ne 0 ]
+then
+ echo "Tag does not exist"
+ exit 1
+fi
+
+# Clone source
+mkdir -p build/source
+mkdir -p dist
+cd build/source
+git clone https://github.com/micahflee/onionshare.git
+cd onionshare
+
+# Verify tag
+git tag -v $TAG 2> ../verify.txt
+if [ $? -ne 0 ]
+then
+ echo "Tag does not verify"
+ exit 1
+fi
+cat ../verify.txt |grep "using RSA key 927F419D7EC82C2F149C1BD1403C2657CD994F73"
+if [ $? -ne 0 ]
+then
+ echo "Tag signed with wrong key"
+ exit 1
+fi
+cat ../verify.txt |grep "^gpg: Good signature from"
+if [ $? -ne 0 ]
+then
+ echo "Tag verification missing 'Good signature from'"
+ exit 1
+fi
+
+# Checkout code
+git checkout $TAG
+
+# Delete .git, compress, and PGP sign
+cd ..
+rm -rf onionshare/.git
+tar -cf onionshare-$VERSION.tar.gz onionshare/
+
+# Move source package to dist
+cd ../..
+mv build/source/onionshare-$VERSION.tar.gz dist
+
+# Clean up
+rm -rf build/source/onionshare
+rm build/source/verify.txt
+
+echo "Source package complete, file in dist"