aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/xds-utils
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-06-07 11:26:16 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-06-07 11:26:16 +0200
commit48ff51998e749dc1c8026e04948faad9d83cedd0 (patch)
treebe546c1f2393bc0bc57cdedbb8c001be7df86226 /scripts/xds-utils
parent61cd1a97e20d58e77470610cb8ee0bd2d5b6d395 (diff)
Add windows and packaging build support.
Diffstat (limited to 'scripts/xds-utils')
-rwxr-xr-xscripts/xds-utils/get-syncthing.sh31
1 files changed, 22 insertions, 9 deletions
diff --git a/scripts/xds-utils/get-syncthing.sh b/scripts/xds-utils/get-syncthing.sh
index 54ca7e1..da06d15 100755
--- a/scripts/xds-utils/get-syncthing.sh
+++ b/scripts/xds-utils/get-syncthing.sh
@@ -8,6 +8,8 @@
[ -z "$SYNCTHING_INOTIFY_VERSION" ] && { SYNCTHING_INOTIFY_VERSION=master; SYNCTHING_INOTIFY_CMID=af6fbf9d63f95a0; }
[ -z "$DESTDIR" ] && DESTDIR=/usr/local/bin
[ -z "$TMPDIR" ] && TMPDIR=/tmp
+[ -z "$GOOS" ] && GOOS=$(go env GOOS)
+[ -z "$GOARCH" ] && GOARCH=$(go env GOARCH)
TEMPDIR=$TMPDIR/.get-st.$$
@@ -18,20 +20,28 @@ cleanExit ()
rm -rf ${TEMPDIR}
}
+TB_EXT="tar.gz"
+EXT=""
+[[ "$GOOS" = "windows" ]] && { TB_EXT="zip"; EXT=".exe"; }
+
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-linux-amd64-v${SYNCTHING_VERSION}.tar.gz" \
+tarball="syncthing-${GOOS}-${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 \
&& grep -E " ${tarball}\$" sha1sum.txt.asc | sha1sum -c - \
- && rm sha1sum.txt.asc \
- && tar -xvf "$tarball" --strip-components=1 "$(basename "$tarball" .tar.gz)"/syncthing \
- && mv syncthing ${DESTDIR}/syncthing || exit 1
+ && rm sha1sum.txt.asc
+ if [ "${TB_EXT}" = "tar.gz" ]; then
+ tar -xvf "$tarball" --strip-components=1 "$(basename "$tarball" .tar.gz)"/syncthing \
+ && mv syncthing ${DESTDIR}/syncthing || exit 1
+ else
+ unzip "$tarball" && mv syncthing-windows-*/syncthing.exe ${DESTDIR}/syncthing.exe || exit 1
+ fi
echo "Get Syncthing-inotify..."
if [ "$SYNCTHING_INOTIFY_VERSION" = "master" ]; then
@@ -46,13 +56,16 @@ if [ "$SYNCTHING_INOTIFY_VERSION" = "master" ]; then
git status
export GOPATH=$(realpath `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 || exit 1
+ go build -v -i -ldflags "-w -X main.Version=$version" -o ${DESTDIR}/syncthing-inotify${EXT} || exit 1
else
-tarball="syncthing-inotify-linux-amd64-v${SYNCTHING_INOTIFY_VERSION}.tar.gz" \
- && curl -sfSL "https://github.com/syncthing/syncthing-inotify/releases/download/v${SYNCTHING_INOTIFY_VERSION}/${tarball}" -O \
- && tar -xvf "${tarball}" syncthing-inotify \
- && mv syncthing-inotify ${DESTDIR}/syncthing-inotify
+ tarball="syncthing-inotify-${GOOS}-${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
+ else
+ unzip "$tarball" && mv syncthing-inotify.exe ${DESTDIR}/syncthing-inotify.exe || exit 1
+ fi
fi
echo "DONE: syncthing and syncthing-inotify successfuly installed in ${DESTDIR}" \ No newline at end of file