app-emulation/flannel: Add initscripts and logrotate file
authorManuel Rüger <mrueg@gentoo.org>
Thu, 3 Aug 2017 18:49:57 +0000 (20:49 +0200)
committerManuel Rüger <mrueg@gentoo.org>
Thu, 3 Aug 2017 18:49:57 +0000 (20:49 +0200)
Package-Manager: Portage-2.3.6, Repoman-2.3.3

app-emulation/flannel/files/flanneld.confd [new file with mode: 0644]
app-emulation/flannel/files/flanneld.initd [new file with mode: 0644]
app-emulation/flannel/files/flanneld.logrotated [new file with mode: 0644]
app-emulation/flannel/flannel-0.8.0-r1.ebuild [new file with mode: 0644]

diff --git a/app-emulation/flannel/files/flanneld.confd b/app-emulation/flannel/files/flanneld.confd
new file mode 100644 (file)
index 0000000..18686aa
--- /dev/null
@@ -0,0 +1,2 @@
+# arguments for flannel
+command_args=""
diff --git a/app-emulation/flannel/files/flanneld.initd b/app-emulation/flannel/files/flanneld.initd
new file mode 100644 (file)
index 0000000..6f75abd
--- /dev/null
@@ -0,0 +1,24 @@
+#!/sbin/openrc-run
+# Copyright 2016-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="Flannel Network Fabric for Containers"
+pidfile=${pidfile:-"/run/${SVCNAME}/${SVCNAME}.pid"}
+user=${user:-root}
+group=${group:-root}
+
+command="/usr/bin/${SVCNAME}"
+command_args="${command_args}"
+command_background="true"
+start_stop_daemon_args="--user ${user} --group ${group} \
+       --stdout /var/log/flannel/flannel.log \
+       --stderr /var/log/flannel/flannel.log"
+
+depend() {
+       need net
+       after net
+}
+
+start_pre() {
+       checkpath -d -m 0755 -o "${user}":"${group}" "${pidfile%/*}"
+}
diff --git a/app-emulation/flannel/files/flanneld.logrotated b/app-emulation/flannel/files/flanneld.logrotated
new file mode 100644 (file)
index 0000000..4108e63
--- /dev/null
@@ -0,0 +1,7 @@
+/var/log/flannel/* {
+       missingok
+       size 5M
+       rotate 3
+       compress
+       copytruncate
+}
diff --git a/app-emulation/flannel/flannel-0.8.0-r1.ebuild b/app-emulation/flannel/flannel-0.8.0-r1.ebuild
new file mode 100644 (file)
index 0000000..5135efe
--- /dev/null
@@ -0,0 +1,51 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit golang-vcs-snapshot systemd user
+
+KEYWORDS="~amd64"
+DESCRIPTION="An etcd backed network fabric for containers"
+EGO_PN="github.com/coreos/flannel"
+HOMEPAGE="https://github.com/coreos/flannel"
+SRC_URI="https://${EGO_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+LICENSE="Apache-2.0"
+SLOT="0"
+IUSE="hardened"
+RESTRICT="test"
+
+src_prepare() {
+       default
+       sed -e "s:^var Version =.*:var Version = \"${PV}\":" \
+               -i "${S}/src/${EGO_PN}/version/version.go" || die
+}
+
+src_compile() {
+       CGO_LDFLAGS="$(usex hardened '-fno-PIC ' '')"\
+       GOPATH="${WORKDIR}/${P}" \
+               go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}"
+       [[ -x bin/${PN} ]] || die
+}
+
+src_test() {
+       GOPATH="${WORKDIR}/${P}" \
+               go test -v -work -x "${EGO_PN}" || die
+}
+
+src_install() {
+       newbin "bin/${PN}" ${PN}d
+       cd "src/${EGO_PN}" || die
+       exeinto /usr/libexec/flannel
+       doexe dist/mk-docker-opts.sh
+       insinto /etc/systemd/system/docker.service.d
+       newins "${FILESDIR}/flannel-docker.conf" flannel.conf
+       newinitd "${FILESDIR}"/flanneld.initd flanneld
+       newconfd "${FILESDIR}"/flanneld.confd flanneld
+       keepdir /var/log/${PN}
+       insinto /etc/logrotate.d
+       newins "${FILESDIR}"/flanneld.logrotated flanneld
+       systemd_newtmpfilesd "${FILESDIR}/flannel.tmpfilesd" flannel.conf
+       systemd_dounit "${FILESDIR}/flanneld.service"
+       dodoc README.md
+}