summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2017-01-22 20:59:26 -0800
committerZac Medico <zmedico@gentoo.org>2017-01-22 21:17:34 -0800
commitf54855d32da5c9c3302ea22e75d1666d65d15a80 (patch)
treef5a7709ac60143610d034a9e1ab98b0e5f7b638d /app-admin/serf
parentprofiles: Add app-emulation/libvirt zfs stable use mask (diff)
downloadgentoo-f54855d32da5c9c3302ea22e75d1666d65d15a80.tar.gz
gentoo-f54855d32da5c9c3302ea22e75d1666d65d15a80.tar.bz2
gentoo-f54855d32da5c9c3302ea22e75d1666d65d15a80.zip
app-admin/serf: add package
Package-Manager: Portage-2.3.3, Repoman-2.3.1
Diffstat (limited to 'app-admin/serf')
-rw-r--r--app-admin/serf/Manifest3
-rw-r--r--app-admin/serf/files/serf.confd7
-rw-r--r--app-admin/serf/files/serf.initd39
-rw-r--r--app-admin/serf/files/serf.logrotated8
-rw-r--r--app-admin/serf/files/serf.service14
-rw-r--r--app-admin/serf/metadata.xml10
-rw-r--r--app-admin/serf/serf-0.8.0.ebuild103
7 files changed, 184 insertions, 0 deletions
diff --git a/app-admin/serf/Manifest b/app-admin/serf/Manifest
new file mode 100644
index 000000000000..6deaa63a4270
--- /dev/null
+++ b/app-admin/serf/Manifest
@@ -0,0 +1,3 @@
+DIST gox-c9740af9c6574448fd48eb30a71f964014c7a837.tar.gz 15772 SHA256 826666828f1ec3e535268fa95d983362c6c773e9a87aa94613e7a47805d22e38 SHA512 d4b2d5d9666285584697bc0d6ddc2f1a1e3f23741650e831adb42baffbb5f72fc3d5ae8a8fb6719faf1df75d3da334941b0404387f0c213aabdb5c3d5634c55d WHIRLPOOL 89d52013bfb563a11a4042760470ac317398c3f8a61b9e7734c3ac2737d916126ad10a113948eb5a8362de3d77e598e42f4a0510760ae67465bde08658947f7a
+DIST iochan-87b45ffd0e9581375c491fef3d32130bb15c5bd7.tar.gz 1785 SHA256 71c117246bb1d4d78ad5c3bc5d301942bcebaae5b1e35da1ad7851ceac71a675 SHA512 2efc0e3cbca496240e3e24550fd0d2aab742eb9b227230ff1ed4ee47344b994642b028bd4644cd45cd697f5f5ef6a729aad65537b10c6555bd52d9ca4b9c717c WHIRLPOOL 15dfd50bfc992a7b6a1b5d672d5bf9bfcb71a357eae371eac773e7fe9ad4ec8d4d0578e0dc6b12bb14689d1497129616b0eb300bbcb483a6865ac315bced562a
+DIST serf-0.8.0.tar.gz 1439191 SHA256 f56e8da3e6cf748c20ae629aacfd652a04adfacfd0ee0af6560c33933d93547a SHA512 2e074ee8d002e6c7803f23d50d42800cf660ee22c968be8adf4f5e4cefde6dd39bf601c9bd91544d5f45d639ed0eec82c31a0fd1b903e8a0223f2cdd967bbf36 WHIRLPOOL 09b5e5471c14e11bbeb214a64ec57720cd31779c9d331bba2eea31cac9859cdff12d925923514272101449f7d62b671e685f768af1cf2f2497ad1a7a36402570
diff --git a/app-admin/serf/files/serf.confd b/app-admin/serf/files/serf.confd
new file mode 100644
index 000000000000..f5aeaeddf7e7
--- /dev/null
+++ b/app-admin/serf/files/serf.confd
@@ -0,0 +1,7 @@
+# you can change the init script behavior by setting those parameters
+# - group (default: serf)
+# - pidfile (default: /run/serf/serf.pid)
+# - user (default: serf)
+
+# extra arguments for the serf agent
+command_args="-config-dir=/etc/serf.d"
diff --git a/app-admin/serf/files/serf.initd b/app-admin/serf/files/serf.initd
new file mode 100644
index 000000000000..ce69aea1d627
--- /dev/null
+++ b/app-admin/serf/files/serf.initd
@@ -0,0 +1,39 @@
+#!/sbin/openrc-run
+# Copyright 2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+description="serf agent"
+extra_started_commands="reload"
+group=${group:-${RC_SVCNAME}}
+pidfile=${pidfile:-"/run/${RC_SVCNAME}/${RC_SVCNAME}.pid"}
+user=${user:-${RC_SVCNAME}}
+
+command="/usr/bin/${RC_SVCNAME}"
+command_args="agent -config-dir=/etc/serf.d ${command_args}"
+command_background="true"
+start_stop_daemon_args="--user ${user} --group ${group} \
+ --stdout /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log \
+ --stderr /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log"
+
+depend() {
+ need net
+ after net
+}
+
+reload() {
+ ebegin "Reloading ${RC_SVCNAME}"
+ ${command} reload
+ eend $?
+}
+
+start_pre() {
+ checkpath -d -m 0755 -o "${user}":"${group}" "${pidfile%/*}"
+}
+
+stop() {
+ # SIGINT is required for graceful shutdown of serf agent
+ ebegin "Stopping ${RC_SVCNAME}"
+ start-stop-daemon --stop --signal SIGINT --pidfile "${pidfile}"
+ eend $?
+}
diff --git a/app-admin/serf/files/serf.logrotated b/app-admin/serf/files/serf.logrotated
new file mode 100644
index 000000000000..b4c778ab29a7
--- /dev/null
+++ b/app-admin/serf/files/serf.logrotated
@@ -0,0 +1,8 @@
+/var/log/serf/serf.log {
+ su serf serf
+ missingok
+ size 5M
+ rotate 3
+ compress
+ copytruncate
+}
diff --git a/app-admin/serf/files/serf.service b/app-admin/serf/files/serf.service
new file mode 100644
index 000000000000..f2d390fe8222
--- /dev/null
+++ b/app-admin/serf/files/serf.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=serf agent
+Requires=network-online.target
+After=network-online.target
+
+[Service]
+User=serf
+Environment=SERF_AGENT_OPTS="-config-dir=/etc/serf.d"
+ExecStart=/usr/bin/serf agent $SERF_AGENT_OPTS
+Restart=on-failure
+KillSignal=SIGINT
+
+[Install]
+WantedBy=multi-user.target
diff --git a/app-admin/serf/metadata.xml b/app-admin/serf/metadata.xml
new file mode 100644
index 000000000000..213d2fe2fa81
--- /dev/null
+++ b/app-admin/serf/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>zmedico@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">hashicorp/serf</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/app-admin/serf/serf-0.8.0.ebuild b/app-admin/serf/serf-0.8.0.ebuild
new file mode 100644
index 000000000000..a28a2255bab3
--- /dev/null
+++ b/app-admin/serf/serf-0.8.0.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit systemd user
+
+KEYWORDS="~amd64"
+EGO_PN="github.com/hashicorp/serf"
+DESCRIPTION="Service orchestration and management tool"
+HOMEPAGE="https://www.serfdom.io/"
+SRC_URI="https://github.com/hashicorp/serf/archive/v${PV}.tar.gz -> ${P}.tar.gz
+ https://github.com/mitchellh/gox/archive/c9740af9c6574448fd48eb30a71f964014c7a837.tar.gz -> gox-c9740af9c6574448fd48eb30a71f964014c7a837.tar.gz
+ https://github.com/mitchellh/iochan/archive/87b45ffd0e9581375c491fef3d32130bb15c5bd7.tar.gz -> iochan-87b45ffd0e9581375c491fef3d32130bb15c5bd7.tar.gz
+"
+
+SLOT="0"
+LICENSE="MPL-2.0"
+IUSE=""
+RESTRICT="test"
+
+DEPEND="
+ >=dev-lang/go-1.6:=
+ >=dev-go/go-tools-0_pre20160121"
+RDEPEND=""
+
+pkg_setup() {
+ enewgroup serf
+ enewuser serf -1 -1 /var/lib/${PN} serf
+}
+
+get_archive_go_package() {
+ local archive=${1} uri x
+ for x in ${SRC_URI}; do
+ if [[ ${x} == http* ]]; then
+ uri=${x}
+ elif [[ ${x} == ${archive} ]]; then
+ break
+ fi
+ done
+ uri=${uri#https://}
+ echo ${uri%/archive/*}
+}
+
+unpack_go_packages() {
+ local go_package x
+ # Unpack packages to appropriate locations for GOPATH
+ for x in ${A}; do
+ unpack ${x}
+ if [[ ${x} == *.tar.gz ]]; then
+ go_package=$(get_archive_go_package ${x})
+ mkdir -p src/${go_package%/*}
+ mv ${go_package##*/}-* src/${go_package} || die
+ fi
+ done
+}
+
+src_unpack() {
+ mkdir "${S}" || die
+ cd "${S}" || die
+ unpack_go_packages
+}
+
+src_prepare() {
+ eapply_user
+ # Avoid the need to have a git checkout
+ sed -e 's:^GIT.*::' \
+ -e 's:-X main.GitCommit.*:" \\:' \
+ -i "${S}/src/${EGO_PN}/scripts/build.sh" || die
+
+ # go install golang.org/x/tools/cmd/stringer: mkdir /usr/lib/go-gentoo/bin/: permission denied
+ sed -e 's:go get -u -v $(GOTOOLS)::' \
+ -e 's:^GIT.*::' \
+ -i "${S}/src/${EGO_PN}/GNUmakefile" || die
+}
+
+src_compile() {
+ export GOPATH="${S}"
+ go install -v -work -x ${EGO_BUILD_FLAGS} "github.com/mitchellh/gox/..." || die
+ PATH=${PATH}:${S}/bin XC_ARCH=$(go env GOARCH) XC_OS=$(go env GOOS) \
+ emake -C "${S}/src/${EGO_PN}" bin
+}
+
+src_install() {
+ local x
+
+ dobin "${S}/bin/${PN}"
+
+ keepdir /etc/serf.d
+ insinto /etc/serf.d
+
+ for x in /var/{lib,log}/${PN}; do
+ keepdir "${x}"
+ fowners serf:serf "${x}"
+ done
+
+ newinitd "${FILESDIR}/serf.initd" "${PN}"
+ newconfd "${FILESDIR}/serf.confd" "${PN}"
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/${PN}.logrotated" "${PN}"
+ systemd_dounit "${FILESDIR}/serf.service"
+}