summaryrefslogtreecommitdiffstats
path: root/bin-net
diff options
context:
space:
mode:
authorVlad Glagolev2022-09-06 00:01:59 +0000
committerVlad Glagolev2022-09-06 00:01:59 +0000
commit4c51b610def9ed50962ddc054dfdcdc06f57f149 (patch)
tree3fe8cc5f115017c48b59b50eb3457833b8a3fa97 /bin-net
parent472e7042b12b5d29aa5b82d51a213a3c181f9349 (diff)
syncthing-bin: add init framework
Diffstat (limited to 'bin-net')
-rwxr-xr-xbin-net/syncthing-bin/BUILD2
-rwxr-xr-xbin-net/syncthing-bin/DEPENDS2
-rwxr-xr-xbin-net/syncthing-bin/DETAILS1
-rwxr-xr-xbin-net/syncthing-bin/FINAL5
-rw-r--r--bin-net/syncthing-bin/HISTORY4
-rwxr-xr-xbin-net/syncthing-bin/INSTALL8
-rwxr-xr-xbin-net/syncthing-bin/init.d/syncthing33
-rw-r--r--bin-net/syncthing-bin/init.d/syncthing.conf3
8 files changed, 56 insertions, 2 deletions
diff --git a/bin-net/syncthing-bin/BUILD b/bin-net/syncthing-bin/BUILD
index 27ba77d..2932a63 100755
--- a/bin-net/syncthing-bin/BUILD
+++ b/bin-net/syncthing-bin/BUILD
@@ -1 +1 @@
-true
+create_account syncthing /var/lib/syncthing
diff --git a/bin-net/syncthing-bin/DEPENDS b/bin-net/syncthing-bin/DEPENDS
new file mode 100755
index 0000000..355760d
--- /dev/null
+++ b/bin-net/syncthing-bin/DEPENDS
@@ -0,0 +1,2 @@
+# for syslog logging
+depends util-linux
diff --git a/bin-net/syncthing-bin/DETAILS b/bin-net/syncthing-bin/DETAILS
index 8fe682e..cdb3813 100755
--- a/bin-net/syncthing-bin/DETAILS
+++ b/bin-net/syncthing-bin/DETAILS
@@ -1,6 +1,7 @@
SPELL=syncthing-bin
SPELLX=${SPELL/-bin/}
VERSION=1.20.4
+ PATCHLEVEL=1
if [[ "${SMGL_COMPAT_ARCHS[1]}" == "x86_64" || "${SMGL_COMPAT_ARCHS[1]}" == "em64t" ]]; then
ARCH=amd64
SOURCE_HASH=sha256:ce577b08236c14ce4e3f2f589791b2521086bdd2ce952800847f0acd1b753dbe:UPSTREAM_HASH
diff --git a/bin-net/syncthing-bin/FINAL b/bin-net/syncthing-bin/FINAL
index 4b6a086..a05a270 100755
--- a/bin-net/syncthing-bin/FINAL
+++ b/bin-net/syncthing-bin/FINAL
@@ -1,3 +1,8 @@
+# binaries require /lib64
+if [ ! -d "${INSTALL_ROOT}/lib64" ]; then
+ ln -vsf "${TRACK_ROOT}/lib" "${INSTALL_ROOT}/lib64"
+fi &&
+
message "${MESSAGE_COLOR}You also want to consider the following:\n"
message "# Increase maximum receive socket buffer size to 2MiB for QUIC connections"
message "# see https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size"
diff --git a/bin-net/syncthing-bin/HISTORY b/bin-net/syncthing-bin/HISTORY
index f458ab2..25022be 100644
--- a/bin-net/syncthing-bin/HISTORY
+++ b/bin-net/syncthing-bin/HISTORY
@@ -1,2 +1,6 @@
+2022-09-05 Vlad Glagolev <stealth@sourcemage.org>
+ * DETAILS: PATCHLEVEL=1
+ * BUILD, INSTALL, init.d: added init framework
+
2022-09-04 Vlad Glagolev <stealth@sourcemage.org>
* DETAILS, BUILD, INSTALL, FINAL: created spell, version 1.20.4
diff --git a/bin-net/syncthing-bin/INSTALL b/bin-net/syncthing-bin/INSTALL
index 8c97ae8..e9a1c81 100755
--- a/bin-net/syncthing-bin/INSTALL
+++ b/bin-net/syncthing-bin/INSTALL
@@ -1 +1,7 @@
-install -vm 755 syncthing "${INSTALL_ROOT}/usr/bin/syncthing"
+install -vm 755 syncthing "${INSTALL_ROOT}/usr/bin/syncthing" &&
+
+local home_dir="${INSTALL_ROOT}/var/lib/${SPELLX}" &&
+
+if [ ! -d "${home_dir}" ]; then
+ install -vm 750 -o syncthing -g syncthing -d "${home_dir}"
+fi
diff --git a/bin-net/syncthing-bin/init.d/syncthing b/bin-net/syncthing-bin/init.d/syncthing
new file mode 100755
index 0000000..81f7d26
--- /dev/null
+++ b/bin-net/syncthing-bin/init.d/syncthing
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+. /etc/sysconfig/syncthing
+
+PROGRAM=/usr/bin/syncthing
+ARGS="--no-browser --no-default-folder --no-restart --logflags=0 --home=/var/lib/syncthing $SYNCTHING_ARGS"
+RUNLEVEL=3
+NEEDS="+network"
+
+start() {
+ echo "Starting $NAME..."
+
+ TIMEOUT=3
+
+ su syncthing -s /bin/sh -c "set -o pipefail; $PROGRAM $ARGS 2>&1 | logger -ip daemon.info -t syncthing" &
+ ppid=$!
+
+ sleep $TIMEOUT && pgrep -P $ppid > /dev/null || wait $ppid
+
+ evaluate_retval
+}
+
+stop() {
+ echo "Stopping $NAME..."
+
+ killproc "syncthing serve"
+}
+
+reload() {
+ _restart
+}
+
+. /etc/init.d/smgl_init
diff --git a/bin-net/syncthing-bin/init.d/syncthing.conf b/bin-net/syncthing-bin/init.d/syncthing.conf
new file mode 100644
index 0000000..ee08705
--- /dev/null
+++ b/bin-net/syncthing-bin/init.d/syncthing.conf
@@ -0,0 +1,3 @@
+# For the arguments and description see ``syncthing serve --help''
+
+SYNCTHING_ARGS=""