summaryrefslogtreecommitdiffstats
path: root/scripts/get-syncthing.sh
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-05-16 00:05:18 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-05-16 00:05:18 +0200
commit8983eebdbe74489d62eae4097580fc430d75bd07 (patch)
tree702eb2c1de7ad52c7aa58286ec02b91e49e537dc /scripts/get-syncthing.sh
parenta840678ea8b627e8a0f952c07a268e4b0be8ee9c (diff)
Use patched version of syncthing-inotify.
Bug #164 has not been properly merged yet. So patch this bug manually. See also https://github.com/syncthing/syncthing-inotify/pull/165
Diffstat (limited to 'scripts/get-syncthing.sh')
-rwxr-xr-xscripts/get-syncthing.sh36
1 files changed, 35 insertions, 1 deletions
diff --git a/scripts/get-syncthing.sh b/scripts/get-syncthing.sh
index 284c58e..8bc5346 100755
--- a/scripts/get-syncthing.sh
+++ b/scripts/get-syncthing.sh
@@ -2,7 +2,10 @@
# Configurable variables
[ -z "$SYNCTHING_VERSION" ] && SYNCTHING_VERSION=0.14.25
-[ -z "$SYNCTHING_INOTIFY_VERSION" ] && SYNCTHING_INOTIFY_VERSION=0.8.5
+
+# FIXME: temporary HACK while waiting merge of #165
+#[ -z "$SYNCTHING_INOTIFY_VERSION" ] && SYNCTHING_INOTIFY_VERSION=0.8.5
+[ -z "$SYNCTHING_INOTIFY_VERSION" ] && SYNCTHING_INOTIFY_VERSION=master_and_patch165
[ -z "$DESTDIR" ] && DESTDIR=/usr/local/bin
[ -z "$TMPDIR" ] && TMPDIR=/tmp
@@ -32,9 +35,40 @@ tarball="syncthing-linux-amd64-v${SYNCTHING_VERSION}.tar.gz" \
echo "Get Syncthing-inotify..."
+if [ "$SYNCTHING_INOTIFY_VERSION" = "master_and_patch165" ]; 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
+ cd syncthing-inotify
+ cat <<EOF > 165.patch
+ diff --git a/syncwatcher.go b/syncwatcher.go
+index c36b034..5175c12 100644
+--- a/syncwatcher.go
++++ b/syncwatcher.go
+@@ -677,7 +677,10 @@ func accumulateChanges(debounceTimeout time.Duration,
+ if flushTimerNeedsReset {
+ flushTimerNeedsReset = false
+ if !flushTimer.Stop() {
+- <-flushTimer.C
++ select {
++ case <-flushTimer.C:
++ default:
++ }
+ }
+ flushTimer.Reset(currInterval)
+ }
+EOF
+ git apply 165.patch || exit 1
+ 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
+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
+fi
echo "DONE: syncthing and syncthing-inotify successfuly installed in ${DESTDIR}" \ No newline at end of file