From 8b1dae336175bca095a41ac0f00045b591705448 Mon Sep 17 00:00:00 2001 From: Horea Christian Date: Wed, 11 Feb 2015 19:40:46 +0100 Subject: [PATCH] pulled from fearedbliss and msva --- net-p2p/syncthing/Manifest | 7 ++ net-p2p/syncthing/files/init.d/syncthing | 38 +++++++++++ net-p2p/syncthing/files/syncthing.service | 10 +++ net-p2p/syncthing/metadata.xml | 8 +++ net-p2p/syncthing/syncthing-0.10.20.ebuild | 76 ++++++++++++++++++++++ net-p2p/syncthing/syncthing-0.10.21.ebuild | 76 ++++++++++++++++++++++ net-p2p/syncthing/syncthing-9999.ebuild | 35 +++------- 7 files changed, 225 insertions(+), 25 deletions(-) create mode 100644 net-p2p/syncthing/Manifest create mode 100644 net-p2p/syncthing/files/init.d/syncthing create mode 100644 net-p2p/syncthing/files/syncthing.service create mode 100644 net-p2p/syncthing/metadata.xml create mode 100644 net-p2p/syncthing/syncthing-0.10.20.ebuild create mode 100644 net-p2p/syncthing/syncthing-0.10.21.ebuild diff --git a/net-p2p/syncthing/Manifest b/net-p2p/syncthing/Manifest new file mode 100644 index 0000000..4b154c1 --- /dev/null +++ b/net-p2p/syncthing/Manifest @@ -0,0 +1,7 @@ +AUX init.d/syncthing 824 SHA256 9996f5b6690f4b8c887da8c4d5174c77ec9d4eb07e522c2453211bf078ec627b SHA512 331add6916fd4a7acd1cbb8c9ae5c46201abb3bbe2cac224e314f9f26514e9a3d2cfa3d725bb9617cd5feda4589b1be46d466248277f807242b5bb52a7d18c92 WHIRLPOOL 0709a9b5ab1df33b83247a37c9e5bb277d787905263651e8e6a5d204e42a796e48189f6c03b6a243fac8f290ddec50912594b996216b01639e52d2efefb0ac81 +AUX syncthing.service 164 SHA256 5b0e8ca9ae9f81bd621dc7d5dab3788f895052ad2547a83adc41a557c9a48afc SHA512 c412b4ef0337bc98a47e34d92395815cbb3ef3c851dcca39a19432194b77880c205402f4346f8848101356b69121ecb649a6e53a7716a25613027195b7312222 WHIRLPOOL 2e732d518b8593632869750a6b77969bc0464b65488299690a49d3fd4a373f2e78dd308c49687bbf4538ca47881524d0c6272e6b426262d89c1ff9ccdac9db13 +DIST syncthing-0.10.20.tar.gz 3098161 SHA256 e4974c2f44cbd1a4d44f3917e85f47651907ec1054802ad555112f5042e93ac8 SHA512 a5c0848980bd1992e69c0d37b1f65498ab6a90d47b42967564413a158867e6145991310f8e9c6eebda75d37820ee1a8ebef26cfecece5bd3ad9ea6f9392d96f1 WHIRLPOOL 9cf1fc7d5a0c457485df4f74dafa0d989f82717e8e3b8c665615de5e492a860c8b61e6548d16e890cc72780474f2344cf420def192e285adc039127fd90604ba +DIST syncthing-0.10.21.tar.gz 3099017 SHA256 241cc0cd6b87040da8551a1d1964ef7201a9f4679b731d6740592063012b2846 SHA512 4db365114dcdaa05f65ad497bb70bed1c38674a32ef0fb14465a7a045f09ce7ed9599634392046fe4c483ba6bf184fe2d1d7216ecb81cd382fa35b74f1ccdfea WHIRLPOOL 2b6f519584e6241e6b823a1984b0232145843f243a1bcd98a93a526f24eb60253bb2af87b5a62c130f51a4b2264e5cb9828bbd5da9cfe682ab8f715c3211ec8a +EBUILD syncthing-0.10.20.ebuild 1906 SHA256 52734a523bc54cad2dfe939fe85fc08b130b486a37ef703aa5f1534dce60910a SHA512 ed220dc9f3dbec3ba1306e04d573193da862b308c73bd05623408d8db5c61d23847eb688a87862bf1b47c1bdf9e3dc0e2cfe48b467ccffd848bc5af0e251a7b2 WHIRLPOOL a792caa425d3ce075c66545fc3f07fc0e56285a15e2283859fd02df3311fb8347d50a353132686e65f1126fefc0bd677e9e7868008731c1069c5f785de2b5cff +EBUILD syncthing-0.10.21.ebuild 1907 SHA256 2f4e9b1e2967acc4cc066d8f9ffc41f5b9a21321104e3256782776541127f2c7 SHA512 893199ad64da42104d40aed9a1047800616fae5928425c33f1e39ee5dd4765567683bc4165e2a896bfaee5d31e6ed128fd9623f98693932a3728ef6f24e8c6f5 WHIRLPOOL 9f5512ba3ddc290f44e2095822ae55302fe80a7c840f111ae338e8fab4a9b5cc49e4623e0760a1dace4e49e7f2465e464f7edb05c7f6e527a2b170d7e344c3d8 +MISC metadata.xml 246 SHA256 1f13fca32620fcc919da81fb9aaa364149cb466bcd86f84f9b20543c3df586b9 SHA512 2e8003ef9d9e5dacc8cb6ebfb7cb6bf605385344fa4db7513aabf1bbf7c7e9052bae47b2faccbd727ccb3d6fb1da9e1881c3d9b711ff23d9d6ed035c0c53f639 WHIRLPOOL 79b333969e70df2668a774d99e5c6c3c6dae462a3c2bc5db4c4f8cbd7adb5d8ea04287d84828353be870d67459b35654e837331938eb920bff5e052d6452c34d diff --git a/net-p2p/syncthing/files/init.d/syncthing b/net-p2p/syncthing/files/init.d/syncthing new file mode 100644 index 0000000..22d70cb --- /dev/null +++ b/net-p2p/syncthing/files/init.d/syncthing @@ -0,0 +1,38 @@ +#!/sbin/runscript + +# Copyright 2014 Jonathan Vasquez +# Distributed under the terms of the GNU General Public License v2 + +NAME="SyncThing" +SYNC_NAME="${SYNC_NAME:-syncthing}" +SYNC_PATH="${SYNC_PATH:-/usr/bin}" +SYNC_BINARY="${SYNC_BINARY:-$SYNC_PATH/$SYNC_NAME}" +SYNC_OPTS="${SYNC_OPTS:--home=/etc/$SYNC_NAME}" +SYNC_PIDFILE="${SYNC_PIDFILE:-/var/run/$SYNC_NAME.pid}" + +start() { + ebegin "Starting ${NAME}" + + start-stop-daemon -m --pidfile "${SYNC_PIDFILE}" -b \ + --start --exec "${SYNC_BINARY}" -- ${SYNC_OPTS} + + eend $? +} + +stop() { + ebegin "Stopping ${NAME}" + + start-stop-daemon --stop --exec "${SYNC_BINARY}" \ + --pidfile "${SYNC_PIDFILE}" + + eend $? +} + +reload() { + ebegin "Reloading ${NAME}" + + start-stop-daemon --signal HUP --exec "${SYNC_BINARY}" \ + --pidfile "${SYNC_PIDFILE}" + + eend $? +} diff --git a/net-p2p/syncthing/files/syncthing.service b/net-p2p/syncthing/files/syncthing.service new file mode 100644 index 0000000..a4981d3 --- /dev/null +++ b/net-p2p/syncthing/files/syncthing.service @@ -0,0 +1,10 @@ +[Unit] +Description=SyncThing + +[Service] +Type=simple +Environment=HOME=/root +ExecStart=/usr/bin/syncthing -home=/etc/syncthing/ + +[Install] +WantedBy=multi-user.target diff --git a/net-p2p/syncthing/metadata.xml b/net-p2p/syncthing/metadata.xml new file mode 100644 index 0000000..be647b9 --- /dev/null +++ b/net-p2p/syncthing/metadata.xml @@ -0,0 +1,8 @@ + + + + + jvasquez1011@gmail.com + Jonathan Vasquez + + diff --git a/net-p2p/syncthing/syncthing-0.10.20.ebuild b/net-p2p/syncthing/syncthing-0.10.20.ebuild new file mode 100644 index 0000000..b679e42 --- /dev/null +++ b/net-p2p/syncthing/syncthing-0.10.20.ebuild @@ -0,0 +1,76 @@ +# Copyright 2014 Jonathan Vasquez +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +inherit user systemd + +GITHUB_USER="syncthing" +GITHUB_REPO="syncthing" +GITHUB_TAG="${PV}" + +NAME="syncthing" +DESCRIPTION="Open Source Continuous File Synchronization" +HOMEPAGE="http://syncthing.net/" + +SRC_URI=" + amd64? ( https://github.com/${GITHUB_USER}/${GITHUB_REPO}/archive/v${GITHUB_TAG}.tar.gz -> ${P}.tar.gz )" + +RESTRICT="mirror" +LICENSE="GPL-3+" +SLOT="0" +KEYWORDS="amd64" + +DEPEND=">=dev-lang/go-1.3.0" + +S="${WORKDIR}" + +configDir="/etc/${PN}" +config="${configDir}/config.xml" + +src_install() { + # Create directory structure recommended by SyncThing Documentation + # Since Go is "very particular" about file locations. + local newBaseDir="src/github.com/${PN}" + local newWorkDir="${newBaseDir}/${PN}" + + mkdir -p "${newBaseDir}" + mv "${P}" "${newWorkDir}" + + cd "${newWorkDir}" + + # Build SyncThing ;D + go run build.go -version v${PV} -no-upgrade=true + + # Copy compiled binary over to image directory + dobin "bin/${PN}" + + # Install the OpenRC init file + doinitd "${FILESDIR}/init.d/${NAME}" + + # Install the systemd unit file + systemd_dounit "${FILESDIR}/${PN}.service" +} + +pkg_postinst() { + if [[ ! -d "${configDir}" ]]; then + mkdir "${configDir}" + fi + + if [[ ! -e "${config}" ]]; then + einfo "Generating default configuration file ..." + + syncthing -generate "${configDir}" + + # Remove 'default' folder (it has an incorrect path anyway) + sed -i '//d' "${config}" + fi + + elog "In order to be able to view the Web UI remotely (from another machine)," + elog "edit your ${config} and change the 127.0.0.1:8080 to 0.0.0.0:8080 in" + elog "the 'address' section." + elog "" + elog "After checking your config, run 'rc-config start ${PN}' to start the application." + elog "Point your browser to the address above to access the Web UI." + elog "" +} diff --git a/net-p2p/syncthing/syncthing-0.10.21.ebuild b/net-p2p/syncthing/syncthing-0.10.21.ebuild new file mode 100644 index 0000000..d454a41 --- /dev/null +++ b/net-p2p/syncthing/syncthing-0.10.21.ebuild @@ -0,0 +1,76 @@ +# Copyright 2014 Jonathan Vasquez +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +inherit user systemd + +GITHUB_USER="syncthing" +GITHUB_REPO="syncthing" +GITHUB_TAG="${PV}" + +NAME="syncthing" +DESCRIPTION="Open Source Continuous File Synchronization" +HOMEPAGE="http://syncthing.net/" + +SRC_URI=" + amd64? ( https://github.com/${GITHUB_USER}/${GITHUB_REPO}/archive/v${GITHUB_TAG}.tar.gz -> ${P}.tar.gz )" + +RESTRICT="mirror" +LICENSE="GPL-3+" +SLOT="0" +KEYWORDS="~amd64" + +DEPEND=">=dev-lang/go-1.3.0" + +S="${WORKDIR}" + +configDir="/etc/${PN}" +config="${configDir}/config.xml" + +src_install() { + # Create directory structure recommended by SyncThing Documentation + # Since Go is "very particular" about file locations. + local newBaseDir="src/github.com/${PN}" + local newWorkDir="${newBaseDir}/${PN}" + + mkdir -p "${newBaseDir}" + mv "${P}" "${newWorkDir}" + + cd "${newWorkDir}" + + # Build SyncThing ;D + go run build.go -version v${PV} -no-upgrade=true + + # Copy compiled binary over to image directory + dobin "bin/${PN}" + + # Install the OpenRC init file + doinitd "${FILESDIR}/init.d/${NAME}" + + # Install the systemd unit file + systemd_dounit "${FILESDIR}/${PN}.service" +} + +pkg_postinst() { + if [[ ! -d "${configDir}" ]]; then + mkdir "${configDir}" + fi + + if [[ ! -e "${config}" ]]; then + einfo "Generating default configuration file ..." + + syncthing -generate "${configDir}" + + # Remove 'default' folder (it has an incorrect path anyway) + sed -i '//d' "${config}" + fi + + elog "In order to be able to view the Web UI remotely (from another machine)," + elog "edit your ${config} and change the 127.0.0.1:8080 to 0.0.0.0:8080 in" + elog "the 'address' section." + elog "" + elog "After checking your config, run 'rc-config start ${PN}' to start the application." + elog "Point your browser to the address above to access the Web UI." + elog "" +} diff --git a/net-p2p/syncthing/syncthing-9999.ebuild b/net-p2p/syncthing/syncthing-9999.ebuild index 7818c04..57a8d3b 100644 --- a/net-p2p/syncthing/syncthing-9999.ebuild +++ b/net-p2p/syncthing/syncthing-9999.ebuild @@ -4,15 +4,15 @@ EAPI="5" -if [ "$PV" != "9999" ]; then - SRC_URI="https://github.com/calmh/${PN}/archive/v${PV}.tar.gz" - KEYWORDS="~amd64 ~x86 ~arm ~darwin ~winnt ~fbsd" -else +#if [ "$PV" != "9999" ]; then +# SRC_URI="https://github.com/calmh/${PN}/archive/v${PV}.tar.gz" +# KEYWORDS="~amd64 ~x86 ~arm ~darwin ~winnt ~fbsd" +#else vcs="git-r3" SRC_URI="" - EGIT_REPO_URI="https://github.com/calmh/${PN}" + EGIT_REPO_URI="https://github.com/syncthing/${PN}" KEYWORDS="" -fi +#fi inherit eutils base ${vcs} @@ -30,36 +30,23 @@ DEPEND=" " RDEPEND="${DEPEND}" -DOCS=( README.md CONTRIBUTORS LICENSE CONTRIBUTING.md ) +DOCS=( README.md AUTHORS LICENSE CONTRIBUTING.md ) export GOPATH="${S}" -GO_PN="github.com/calmh/${PN}" +GO_PN="github.com/syncthing/${PN}" EGIT_CHECKOUT_DIR="${S}/src/${GO_PN}" S="${EGIT_CHECKOUT_DIR}" -src_prepare() { - ewarn "Sorry, but now we'll cut off 'upgrade' command from the syncthing" - ewarn "We're not a Windows©®™ and we can't trust selfupgrades from precompiled binaries" - -# cd "${EGIT_CHECKOUT_DIR}" - epatch "${FILESDIR}"/0.8.14_no_bin_upgrades.patch -# rm "${EGIT_CHECKOUT_DIR}/cmd/syncthing/upgrade.go" - rm cmd/syncthing/upgrade.go -} - src_compile() { -# cd ${EGIT_CHECKOUT_DIR} - # XXX: All the stuff below needs for "-version" command to show actual info - local version="$(git describe --always)"; + local version="$(git describe --always | sed 's/\([v\.0-9]*\)\(-\(beta\|alpha\)[0-9]*\)\?-/\1\2+/')"; local date="$(git show -s --format=%ct)"; local user="$(whoami)" local host="$(hostname)"; host="${host%%.*}"; local lf="-w -X main.Version ${version} -X main.BuildStamp ${date} -X main.BuildUser ${user} -X main.BuildHost ${host}" -# go vet ./... - godep go build -ldflags "${lf}" ./cmd/syncthing + godep go build -ldflags "${lf}" -tags noupgrade ./cmd/syncthing use tools && ( godep go build ./cmd/stcli @@ -69,8 +56,6 @@ src_compile() { } src_install() { -# cd ${EGIT_CHECKOUT_DIR} - dobin syncthing use tools && dobin stcli stpidx discosrv base_src_install_docs