From 1bfb086c905d669655142b3331bccd85482dd90c Mon Sep 17 00:00:00 2001 From: Rik Veenboer Date: Tue, 22 Mar 2016 23:29:25 +0100 Subject: [PATCH] Add files for syncthing container --- build/boot/syncthing.sh | 9 +++++++++ build/make/syncthing.mk | 5 +++++ build/runit/syncthing | 3 +++ build/scripts/syncthing.sh | 30 ++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+) create mode 100644 build/boot/syncthing.sh create mode 100644 build/make/syncthing.mk create mode 100644 build/runit/syncthing create mode 100644 build/scripts/syncthing.sh diff --git a/build/boot/syncthing.sh b/build/boot/syncthing.sh new file mode 100644 index 0000000..08f148a --- /dev/null +++ b/build/boot/syncthing.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -e +if [ ! -f $SYNCTHING_CONFIG ]; then + /opt/syncthing/syncthing --generate="$SYNCTHING_CONFIG" + # don't take the whole volume with the default so that we can add additional folders + sed -e "s~id=\"default\" path=\"/root/Sync\"~id=\"default\" path=\"$SYNCTHING_DATA/default\"~" -i $SYNCTHING_CONFIG/config.xml + # ensure we can see the web ui outside of the docker container + sed -e "s/
127.0.0.1:8384/
0.0.0.0:8080/" -i $SYNCTHING_CONFIG/config.xml +fi \ No newline at end of file diff --git a/build/make/syncthing.mk b/build/make/syncthing.mk new file mode 100644 index 0000000..674fe8f --- /dev/null +++ b/build/make/syncthing.mk @@ -0,0 +1,5 @@ +syncthing: + $(call script,$@) + $(call runit,$@) + $(call boot,02,$@) + \ No newline at end of file diff --git a/build/runit/syncthing b/build/runit/syncthing new file mode 100644 index 0000000..909739a --- /dev/null +++ b/build/runit/syncthing @@ -0,0 +1,3 @@ +#!/bin/sh +set -e +/opt/syncthing/syncthing -home=$SYNCTHING_CONFIG \ No newline at end of file diff --git a/build/scripts/syncthing.sh b/build/scripts/syncthing.sh new file mode 100644 index 0000000..aa8cdf1 --- /dev/null +++ b/build/scripts/syncthing.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -e +source /build/config +set -x + +## Configuration +export_env SYNCTHING_CONFIG /host/etc/syncthing +export_env SYNCTHING_VERSION 0.12.20 + +## Dependencies +apt_install_temporary curl ca-certificates + +## Gosu +# gpg --keyserver pgp.mit.edu --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 +# curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" +# curl -o /usr/local/bin/gosu.asc -L "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" +# gpg --verify /usr/local/bin/gosu.asc +# rm /usr/local/bin/gosu.asc +# chmod +x /usr/local/bin/gosu + +# Syncthing +cd /opt +curl -L -o syncthing.tar.gz https://github.com/syncthing/syncthing/releases/download/v$SYNCTHING_VERSION/syncthing-linux-amd64-v$SYNCTHING_VERSION.tar.gz +tar -xzvf syncthing.tar.gz +rm -f syncthing.tar.gz +mv syncthing-linux-amd64-v* syncthing +rm -rf syncthing/etc +rm -rf syncthing/*.pdf +mkdir -p $SYNCTHING_CONFIG +mkdir -p $SYNCTHING_DATA \ No newline at end of file