summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-06-15 00:28:22 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-06-15 00:47:09 +0200
commit3cc44be399ce1929792f65bcb2fa3de9bc12d2dd (patch)
tree77a2da7186885ce80fdd28b5820b8ff8708acfd0 /scripts
parent09be103ad9fd3d468db65b4c885738336d55df98 (diff)
Add MacOs/darwin package generation
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/get-syncthing.sh23
1 files changed, 16 insertions, 7 deletions
diff --git a/scripts/get-syncthing.sh b/scripts/get-syncthing.sh
index da06d15..368c941 100755
--- a/scripts/get-syncthing.sh
+++ b/scripts/get-syncthing.sh
@@ -10,27 +10,36 @@
[ -z "$TMPDIR" ] && TMPDIR=/tmp
[ -z "$GOOS" ] && GOOS=$(go env GOOS)
[ -z "$GOARCH" ] && GOARCH=$(go env GOARCH)
+[ -z "$CLEANUP" ] && CLEANUP=false
-TEMPDIR=$TMPDIR/.get-st.$$
+TEMPDIR=$TMPDIR/.get-syncthing.tmp
mkdir -p ${TEMPDIR} && cd ${TEMPDIR} || exit 1
trap "cleanExit" 0 1 2 15
cleanExit ()
{
- rm -rf ${TEMPDIR}
+ if [ "$CLEANUP" = "true" ]; then
+ rm -rf ${TEMPDIR}
+ fi
}
TB_EXT="tar.gz"
EXT=""
[[ "$GOOS" = "windows" ]] && { TB_EXT="zip"; EXT=".exe"; }
+GOOS_ST=${GOOS}
+GOOS_STI=${GOOS}
+[[ "$GOOS" = "darwin" ]] && GOOS_ST="macosx"
+
echo "Get Syncthing..."
+
+
## Install Syncthing + Syncthing-inotify
## gpg: key 00654A3E: public key "Syncthing Release Management <release@syncthing.net>" imported
gpg -q --keyserver pool.sks-keyservers.net --recv-keys 37C84554E7E0A261E4F76E1ED26E6ED000654A3E || exit 1
-tarball="syncthing-${GOOS}-${GOARCH}-v${SYNCTHING_VERSION}.${TB_EXT}" \
+tarball="syncthing-${GOOS_ST}-${GOARCH}-v${SYNCTHING_VERSION}.${TB_EXT}" \
&& curl -sfSL "https://github.com/syncthing/syncthing/releases/download/v${SYNCTHING_VERSION}/${tarball}" -O \
&& curl -sfSL "https://github.com/syncthing/syncthing/releases/download/v${SYNCTHING_VERSION}/sha1sum.txt.asc" -O \
&& gpg -q --verify sha1sum.txt.asc \
@@ -47,19 +56,19 @@ echo "Get Syncthing-inotify..."
if [ "$SYNCTHING_INOTIFY_VERSION" = "master" ]; then
mkdir -p ${TEMPDIR}/syncthing-inotify-build/src/github.com/syncthing || exit 1
cd ${TEMPDIR}/syncthing-inotify-build/src/github.com/syncthing
- git clone https://github.com/syncthing/syncthing || exit 1
- git clone https://github.com/syncthing/syncthing-inotify || exit 1
+ [[ ! -d ./syncthing ]] && (git clone https://github.com/syncthing/syncthing || exit 1; )
+ [[ ! -d ./syncthing-inotify ]] && (git clone https://github.com/syncthing/syncthing-inotify || exit 1; )
cd syncthing-inotify
if [ "$SYNCTHING_INOTIFY_CMID" != "" ]; then
git checkout -q $SYNCTHING_INOTIFY_CMID || exit 1
fi
git status
- export GOPATH=$(realpath `pwd`/../../../..)
+ export GOPATH=$(cd ../../../.. && pwd)
version=$(git describe --tags --always | sed 's/^v//')__patch_165
go build -v -i -ldflags "-w -X main.Version=$version" -o ${DESTDIR}/syncthing-inotify${EXT} || exit 1
else
- tarball="syncthing-inotify-${GOOS}-${GOARCH}-v${SYNCTHING_INOTIFY_VERSION}.${TB_EXT}"
+ tarball="syncthing-inotify-${GOOS_STI}-${GOARCH}-v${SYNCTHING_INOTIFY_VERSION}.${TB_EXT}"
curl -sfSL "https://github.com/syncthing/syncthing-inotify/releases/download/v${SYNCTHING_INOTIFY_VERSION}/${tarball}" -O || exit 1
if [ "${TB_EXT}" = "tar.gz" ]; then
tar -xvf "${tarball}" syncthing-inotify && mv syncthing-inotify ${DESTDIR}/syncthing-inotify || exit 1