From 28eb8e07b152e0266b4055618c96fab3225ac1ca Mon Sep 17 00:00:00 2001 From: Sebastian Arcus Date: Fri, 20 May 2016 01:26:42 +0700 Subject: network/syncthing: Updated for version 0.13.0 + new maintainer. Signed-off-by: Willy Sudiarto Raharjo --- network/syncthing/README | 25 ++++++++++++++++++------- network/syncthing/doinst.sh | 1 + network/syncthing/rc.syncthing | 34 +++++++++++++++++++++++++++++----- network/syncthing/slack-desc | 10 +++++----- network/syncthing/syncthing.SlackBuild | 24 ++++++++++++++++++++---- network/syncthing/syncthing.info | 14 +++++++------- network/syncthing/syncthing.logrotate | 9 +++++++++ 7 files changed, 89 insertions(+), 28 deletions(-) create mode 100644 network/syncthing/syncthing.logrotate (limited to 'network') diff --git a/network/syncthing/README b/network/syncthing/README index b5d5498278..d5672c9ded 100644 --- a/network/syncthing/README +++ b/network/syncthing/README @@ -1,9 +1,20 @@ -Syncthing provides synchronization of a folder between a number of -collaborating devices. +Syncthing (two way file sync between devices) -To start automatic at boot make /etc/rc.d/rc.syncthing executable: -chmod +x /etc/rc.d/rc.syncthing -and add it to /etc/rc.d/rc.local -syncthing will then be started as root +Syncthing is a free, open-source peer-to-peer, two-way file +syncronisation application available for Windows, Mac, Linux, iOS, +Android, Solaris, Darwin and BSD. It can sync files between devices +on a local network, or between remote devices over the Internet. -Use your browser to configure syncthing: http://127.0.0.1:8080/ +Before you can build Syncthing, you have to create a syncthing +user and group: + +# groupadd -g 307 syncthing +# useradd -d /var/lib/syncthing -g syncthing -s /bin/bash -u 307 syncthing + +This package includes a rc.syncthing startup script, suitable for +running Syncthing as a system daemon - such as on a server. + +The default location for the Syncthing config *and* sync repository +if run using the enclosed rc.syncthing is under /var/lib/syncthing, +but Syncthing is normally configured through its own web interface. +See project page for further details. diff --git a/network/syncthing/doinst.sh b/network/syncthing/doinst.sh index f171eaf450..9d663d4e1b 100644 --- a/network/syncthing/doinst.sh +++ b/network/syncthing/doinst.sh @@ -21,4 +21,5 @@ preserve_perms() { config $NEW } +config etc/logrotate.d/syncthing.new preserve_perms etc/rc.d/rc.syncthing.new diff --git a/network/syncthing/rc.syncthing b/network/syncthing/rc.syncthing index 9e13fac946..1ba6fd4f52 100644 --- a/network/syncthing/rc.syncthing +++ b/network/syncthing/rc.syncthing @@ -1,13 +1,37 @@ #!/bin/sh + +# Copyright 2016, Sebastian Arcus, UK +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: # -# syncthing start script +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +SYNCTHING_USER="syncthing" +SYNCTHING="/usr/bin/syncthing" +CONFDIR="/var/lib/syncthing/config" +LOGFILE="/var/log/syncthing/syncthing.log" +LOGFLAGS="11" +ST_ARGS="-no-browser" case "$1" in stop) - PID=/var/run/syncthing/syncthing.pid - if [ -f $PID ]; then + if /usr/bin/pgrep -f /usr/bin/syncthing >/dev/null; then echo "Stop Syncthing..." - kill "`cat /var/run/syncthing/syncthing.pid`" + killall syncthing 2>/dev/null else echo "Syncthing is not running..." exit 1 @@ -15,7 +39,7 @@ case "$1" in ;; start) echo "Start Syncthing..." - /usr/bin/syncthing + su - $ST_USER -c "$SYNCTHING -home=$CONFDIR -logfile=$LOGFILE -logflags=$LOGFLAGS" $ST_ARGS 1>/dev/null 2>&1 & ;; restart) $0 stop diff --git a/network/syncthing/slack-desc b/network/syncthing/slack-desc index 2f647912cf..48a30e2ccc 100644 --- a/network/syncthing/slack-desc +++ b/network/syncthing/slack-desc @@ -6,14 +6,14 @@ # customary to leave one space after the ':' except on otherwise blank lines. |-----handy-ruler------------------------------------------------------| -syncthing: syncthing (sync files between your own devices) -syncthing: -syncthing: Syncthing provides synchronization of a folder between a number of -syncthing: collaborating devices +syncthing: syncthing (two way file sync between devices) syncthing: +syncthing: Syncthing is a free, open-source peer-to-peer, two-way file +syncthing: syncronisation application available for Windows, Mac, Linux, iOS, +syncthing: Android, Solaris, Darwin and BSD. It can sync files between devices +syncthing: on a local network, or between remote devices over the Internet. syncthing: syncthing: https://github.com/syncthing/syncthing syncthing: syncthing: syncthing: -syncthing: diff --git a/network/syncthing/syncthing.SlackBuild b/network/syncthing/syncthing.SlackBuild index 69992495f5..8a154a675b 100644 --- a/network/syncthing/syncthing.SlackBuild +++ b/network/syncthing/syncthing.SlackBuild @@ -1,6 +1,7 @@ #!/bin/sh # Slackware build script for syncthing # Copyright 2015 Lionel Young, United States +# Copyright 2016 Sebastian Arcus, United Kingdom # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -21,7 +22,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=syncthing -VERSION=${VERSION:-0.11.10} +VERSION=${VERSION:-0.13.0} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -49,6 +50,14 @@ OUTPUT=${OUTPUT:-/tmp} set -e +# Check if the syncthing user and group exist. If not, then bail. +if [ "$(id -g syncthing 2> /dev/null)" != "307" -o "$(id -u syncthing 2> /dev/null)" != "307" ]; then + echo " You must have an 'syncthing' user and group to run this script." + echo " # groupadd -g 307 syncthing" + echo " # useradd -d /var/lib/syncthing -g syncthing -s /bin/bash -u 307 syncthing" + exit 1 +fi + rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP @@ -71,12 +80,19 @@ install -Dm755 syncthing $PKG/usr/bin/syncthing # Install rc script mkdir -p $PKG/etc/rc.d cat $CWD/rc.syncthing > $PKG/etc/rc.d/rc.syncthing.new +chmod 0644 $PKG/etc/rc.d/rc.syncthing.new + +# Install logrotate script +mkdir -p $PKG/etc/logrotate.d +cat $CWD/syncthing.logrotate > $PKG/etc/logrotate.d/syncthing.new -mkdir -p $PKG/var/lib/syncthing -mkdir -p $PKG/var/run/syncthing +mkdir -p -m 750 $PKG/var/lib/syncthing/config +mkdir -p -m 750 $PKG/var/log/syncthing +mkdir -p -m 750 $PKG/var/run/syncthing +chown -R syncthing.syncthing $PKG/var/{lib,run,log}/syncthing mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a *.txt *.pdf $PKG/usr/doc/$PRGNAM-$VERSION +cp -a *.txt extra/*.pdf $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install diff --git a/network/syncthing/syncthing.info b/network/syncthing/syncthing.info index de3eacf1ad..8f682196c3 100644 --- a/network/syncthing/syncthing.info +++ b/network/syncthing/syncthing.info @@ -1,10 +1,10 @@ PRGNAM="syncthing" -VERSION="0.11.10" +VERSION="0.13.0" HOMEPAGE="https://github.com/syncthing/syncthing" -DOWNLOAD="https://github.com/syncthing/syncthing/releases/download/v0.11.10/syncthing-linux-386-v0.11.10.tar.gz" -MD5SUM="af3bf134b23319b7b90bce1900488e15" -DOWNLOAD_x86_64="https://github.com/syncthing/syncthing/releases/download/v0.11.10/syncthing-linux-amd64-v0.11.10.tar.gz" -MD5SUM_x86_64="e4057144c28ea9618149432012861d61" +DOWNLOAD="https://github.com/syncthing/syncthing/releases/download/v0.13.0/syncthing-linux-386-v0.13.0.tar.gz" +MD5SUM="24d9b638a6bee6639e48cb3d538432f7" +DOWNLOAD_x86_64="https://github.com/syncthing/syncthing/releases/download/v0.13.0/syncthing-linux-amd64-v0.13.0.tar.gz" +MD5SUM_x86_64="21552f0332fbeb95f310cad18714ca3d" REQUIRES="" -MAINTAINER="Lionel Young" -EMAIL="lionelyoung@gmail.com" +MAINTAINER="Sebastian Arcus" +EMAIL="s.arcus@open-t.co.uk" diff --git a/network/syncthing/syncthing.logrotate b/network/syncthing/syncthing.logrotate new file mode 100644 index 0000000000..11a42aec64 --- /dev/null +++ b/network/syncthing/syncthing.logrotate @@ -0,0 +1,9 @@ +/var/log/syncthing/*.log { + weekly + rotate 4 + compress + missingok + notifempty + copytruncate +} + -- cgit v1.2.3