1 |
commit: 3884caa5b45b6216d0cf36d4831bbcec7e63c3d7 |
2 |
Author: Ultrabug <ultrabug <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jun 3 14:05:05 2014 +0000 |
4 |
Commit: Alexys Jacob <ultrabug <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jun 3 14:05:05 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/ultrabug.git;a=commit;h=3884caa5 |
7 |
|
8 |
consul ebuild enhancement and init script |
9 |
|
10 |
--- |
11 |
app-admin/consul/Manifest | 4 +++- |
12 |
app-admin/consul/consul-0.2.1.ebuild | 23 ++++++++++++++++++++--- |
13 |
app-admin/consul/files/consul-agent.confd | 2 ++ |
14 |
app-admin/consul/files/consul-agent.initd | 24 ++++++++++++++++++++++++ |
15 |
4 files changed, 49 insertions(+), 4 deletions(-) |
16 |
|
17 |
diff --git a/app-admin/consul/Manifest b/app-admin/consul/Manifest |
18 |
index 10a18f8..dbdaaa9 100644 |
19 |
--- a/app-admin/consul/Manifest |
20 |
+++ b/app-admin/consul/Manifest |
21 |
@@ -1 +1,3 @@ |
22 |
-EBUILD consul-0.2.1.ebuild 1020 SHA256 c425c13b033c36d871078c01ae629de1b179b736068d7a1e13799ed387574e19 SHA512 58ca9a619e2f128ea7c72d9c423c7b3bfd3ee9a15873f7180b134b92d608bd87145187987c9a40ac0205aaf4bb3592a0d2c440858442096e8623b311bcdaa923 WHIRLPOOL 6d8dc042f0cea42c57dddb73774d699166905bdecca8daa57021fc665a7897cac5cf6f7dd34bf0b6cbcfada980bfad0461f851b87c784964a4fdf904428e2f8c |
23 |
+AUX consul-agent.confd 101 SHA256 281d2ee5847409674d1bd00152bd107649cd987a47423a58ebc405fd87720dc9 SHA512 d33f733b497c07262464c59f9bac7a8312865ab90ec959ccbcba442f799ec740275798e20e938a2d0f316c63eccc72a24cfe8792a13a7ec21e828d08bebe2b62 WHIRLPOOL f29cc61d88754a52a92634bc5b663f5d00c1b596167902ee06122f7703b454410e02ec7cfba21e8aaae1a472ccf44abcd3bc5933ddf06330a7f69418b77f9929 |
24 |
+AUX consul-agent.initd 598 SHA256 ffeb1d4ec42a9ffbe6d0e1bd5b5051a519f19a5a0d295dd696f45be450fce5c6 SHA512 5cfaff1c625c509d309b8328623c6ae461ea3a5206123c2cdfc22d76cbde74dcf532b308be1e6ec640d0a46cdfbf361302ffc6a05f7c6e3b3a0e70602ebe0c25 WHIRLPOOL 48f8c1b13f7d7c49e912491d1def8b6c19b6a6478574adc5ae7912a055a6a3670083305f81308782feeb40b349f32d4d7ee11184358f9d075ece692b3cdef9c3 |
25 |
+EBUILD consul-0.2.1.ebuild 1352 SHA256 ff195f991235f980d00e1a3142e06f249c36c9cdb831cfec07c39db6f22747c3 SHA512 460f0c3339bcee0d4801534a2175587d2823b12427680a07faad5954f7f0c19b9f3eacace6bc12445d881d43a56c6bacf2daaab4ebca9c01b08c045ca0e0e9e5 WHIRLPOOL dccf7a514b0718cdcaf743c7b551c01b127b79dbfd7611264f7afc253ef196bcf9ac135cff455723526752aef8b3038f9dd80c7021c3e0f12ada83f5f6a4e2a2 |
26 |
|
27 |
diff --git a/app-admin/consul/consul-0.2.1.ebuild b/app-admin/consul/consul-0.2.1.ebuild |
28 |
index 11ea2fd..215cfcb 100644 |
29 |
--- a/app-admin/consul/consul-0.2.1.ebuild |
30 |
+++ b/app-admin/consul/consul-0.2.1.ebuild |
31 |
@@ -16,7 +16,7 @@ else |
32 |
KEYWORDS="~amd64 ~x86" |
33 |
fi |
34 |
|
35 |
-inherit git-2 |
36 |
+inherit git-2 user |
37 |
|
38 |
LICENSE="MPL-2.0" |
39 |
SLOT="0" |
40 |
@@ -28,6 +28,11 @@ DEPEND=" |
41 |
" |
42 |
RDEPEND="${DEPEND}" |
43 |
|
44 |
+pkg_setup() { |
45 |
+ enewgroup consul |
46 |
+ enewuser consul -1 -1 /var/lib/${PN} consul |
47 |
+} |
48 |
+ |
49 |
src_prepare() { |
50 |
# see : https://github.com/hashicorp/consul/pull/188 |
51 |
sed -e 's/format:/format: deps/g' -i Makefile |
52 |
@@ -40,10 +45,12 @@ src_compile() { |
53 |
|
54 |
local MY_S="${GOPATH}/src/github.com/hashicorp/consul" |
55 |
|
56 |
- # make sure consul itself is in our GOPATH |
57 |
+ # move consul itself in our GOPATH |
58 |
mkdir -p "${GOPATH}/src/github.com/hashicorp" || die |
59 |
mv "${S}" "${MY_S}" || die |
60 |
- ln -sf "${MY_S}" "${S}" |
61 |
+ |
62 |
+ # piggyback our $S |
63 |
+ ln -sf "${MY_S}" "${S}" || die |
64 |
|
65 |
# let's do something fun |
66 |
emake |
67 |
@@ -51,4 +58,14 @@ src_compile() { |
68 |
|
69 |
src_install() { |
70 |
dobin bin/consul |
71 |
+ |
72 |
+ dodir /etc/consul.d |
73 |
+ |
74 |
+ for x in /var/{lib,log}/${PN}; do |
75 |
+ keepdir "${x}" |
76 |
+ fowners consul:consul "${x}" |
77 |
+ done |
78 |
+ |
79 |
+ newinitd "${FILESDIR}/consul-agent.initd" "${PN}-agent" |
80 |
+ newconfd "${FILESDIR}/consul-agent.confd" "${PN}-agent" |
81 |
} |
82 |
|
83 |
diff --git a/app-admin/consul/files/consul-agent.confd b/app-admin/consul/files/consul-agent.confd |
84 |
new file mode 100644 |
85 |
index 0000000..7f8ec86 |
86 |
--- /dev/null |
87 |
+++ b/app-admin/consul/files/consul-agent.confd |
88 |
@@ -0,0 +1,2 @@ |
89 |
+# extra arguments for the consul agent |
90 |
+command_args="-server -bootstrap -data-dir=/tmp/consul-server" |
91 |
\ No newline at end of file |
92 |
|
93 |
diff --git a/app-admin/consul/files/consul-agent.initd b/app-admin/consul/files/consul-agent.initd |
94 |
new file mode 100644 |
95 |
index 0000000..f01a376 |
96 |
--- /dev/null |
97 |
+++ b/app-admin/consul/files/consul-agent.initd |
98 |
@@ -0,0 +1,24 @@ |
99 |
+#!/sbin/runscript |
100 |
+# Copyright 1999-2014 Gentoo Foundation |
101 |
+# Distributed under the terms of the GNU General Public License v2 |
102 |
+# $Header: $ |
103 |
+ |
104 |
+pidfile=${pidfile:-"/run/${SVCNAME}.pid"} |
105 |
+ |
106 |
+command="/usr/bin/consul" |
107 |
+command_args="agent ${command_args} -pid-file ${pidfile}" |
108 |
+start_stop_daemon_args="--background --stdout /var/log/consul/${SVCNAME}.log" |
109 |
+ |
110 |
+description="tool for service discovery, monitoring and configuration." |
111 |
+extra_started_commands="reload" |
112 |
+ |
113 |
+depend() { |
114 |
+ need hostname |
115 |
+ use net |
116 |
+} |
117 |
+ |
118 |
+reload() { |
119 |
+ ebegin "Reloading ${SVCNAME}" |
120 |
+ start-stop-daemon --signal SIGHUP --pidfile "${pidfile}" |
121 |
+ eend $? |
122 |
+} |
123 |
\ No newline at end of file |