syncthing: add package
authorPaul Spooren <mail@aparcar.org>
Tue, 26 Jun 2018 03:28:21 +0000 (12:28 +0900)
committerPaul Spooren <mail@aparcar.org>
Thu, 22 Aug 2019 01:21:36 +0000 (15:21 -1000)
Signed-off-by: Paul Spooren <mail@aparcar.org>
utils/syncthing/Makefile [new file with mode: 0644]
utils/syncthing/files/etc/config/syncthing [new file with mode: 0644]
utils/syncthing/files/etc/init.d/syncthing [new file with mode: 0755]
utils/syncthing/files/etc/syncthing/index-v0.14.0.db [new symlink]

diff --git a/utils/syncthing/Makefile b/utils/syncthing/Makefile
new file mode 100644 (file)
index 0000000..5b91dd6
--- /dev/null
@@ -0,0 +1,66 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=syncthing
+PKG_VERSION:=1.2.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=syncthing-source-v$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://github.com/syncthing/syncthing/releases/download/v$(PKG_VERSION)
+PKG_HASH:=313bd59ddc2562e833fc4caa8d90360a06d5ff02976c0a4d5d42393e6f8bceac
+
+PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/$(PKG_NAME)
+
+PKG_MAINTAINER:=Paul Spooren <mail@aparcar.org>
+PKG_LICENSE:=MPL-2.0
+PKG_LICENSE_FILES:=LICENSE
+PKG_CPE_ID:=cpe:/a:syncthing:syncthing
+
+PKG_BUILD_DEPENDS:=golang/host
+PKG_BUILD_PARALLEL:=1
+PKG_USE_MIPS16:=0
+
+GO_PKG:=github.com/syncthing/syncthing/
+GO_PKG_BUILD_PKG:=github.com/syncthing/syncthing/cmd/syncthing/
+GO_PKG_INSTALL_EXTRA:=^gui/
+
+include $(INCLUDE_DIR)/package.mk
+include ../../lang/golang/golang-package.mk
+
+define Package/syncthing
+  TITLE:=Continuous file synchronization program
+  URL:=https://syncthing.net
+  DEPENDS:=$(GO_ARCH_DEPENDS)
+  SECTION:=utils
+  CATEGORY:=Utilities
+endef
+
+GO_PKG_LDFLAGS_X:=\
+       main.Version=v$(PKG_VERSION) \
+       main.BuildUser=openwrt \
+       main.BuildHost=openwrt \
+       main.BuildStamp=$(SOURCE_DATE_EPOCH)
+
+define Build/Compile
+  $(call GoPackage/Build/Compile,-tags noupgrade)
+endef
+
+define Package/syncthing/conffiles
+/etc/config/syncthing
+/etc/syncthing
+endef
+
+define Package/syncthing/description
+               Syncthing replaces proprietary sync and cloud services with something
+               open, trustworthy and decentralized. Your data is your data alone and
+               you deserve to choose where it is stored, if it is shared with some
+               third party and how it's transmitted over the Internet.
+endef
+
+define Package/syncthing/install
+       $(call GoPackage/Package/Install/Bin,$(1))
+
+       $(CP) ./files/* $(1)/
+endef
+
+$(eval $(call GoBinPackage,syncthing))
+$(eval $(call BuildPackage,syncthing))
diff --git a/utils/syncthing/files/etc/config/syncthing b/utils/syncthing/files/etc/config/syncthing
new file mode 100644 (file)
index 0000000..9c17b68
--- /dev/null
@@ -0,0 +1,3 @@
+config syncthing 'syncthing'
+    option gui_address 'http://127.0.0.1:8384'
+    option home '/etc/syncthing/'
diff --git a/utils/syncthing/files/etc/init.d/syncthing b/utils/syncthing/files/etc/init.d/syncthing
new file mode 100755 (executable)
index 0000000..1740351
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh /etc/rc.common
+
+START=99
+
+PROG=/usr/bin/syncthing
+
+start_service() {
+    [ -d /var/syncthing/ ] || mkdir /var/syncthing/
+
+    local gui_address home
+    config_load "syncthing"
+    config_get gui_address syncthing gui_address "http://127.0.0.1:8384"
+    config_get home syncthing home "/etc/syncthing/"
+
+    procd_open_instance
+    procd_set_param command "$PROG"
+    procd_append_param command -gui-address="$gui_address"
+    procd_append_param command -home="$home"
+    procd_set_param respawn
+    procd_close_instance
+}
diff --git a/utils/syncthing/files/etc/syncthing/index-v0.14.0.db b/utils/syncthing/files/etc/syncthing/index-v0.14.0.db
new file mode 120000 (symlink)
index 0000000..3bfbcfa
--- /dev/null
@@ -0,0 +1 @@
+/var/syncthing/
\ No newline at end of file