1 |
commit: 436e19902cf8f23717c3605903248dcb273b890e |
2 |
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Oct 24 21:37:04 2020 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Oct 24 22:12:00 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=436e1990 |
7 |
|
8 |
sys-apps/ipmitool: cleanup init & add contrib tools |
9 |
|
10 |
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> |
11 |
|
12 |
.../files/exchange-bmc-os-info-1.8.18.initd | 23 +++ |
13 |
.../ipmitool/files/ipmitool-1.8.18-ipmievd.confd | 27 +++ |
14 |
.../ipmitool/files/ipmitool-1.8.18-ipmievd.initd | 28 +++ |
15 |
sys-apps/ipmitool/files/log_bmc-1.8.18.initd | 25 +++ |
16 |
.../ipmitool/ipmitool-1.8.18_p20201004-r2.ebuild | 200 +++++++++++++++++++++ |
17 |
5 files changed, 303 insertions(+) |
18 |
|
19 |
diff --git a/sys-apps/ipmitool/files/exchange-bmc-os-info-1.8.18.initd b/sys-apps/ipmitool/files/exchange-bmc-os-info-1.8.18.initd |
20 |
new file mode 100644 |
21 |
index 00000000000..9c63983f21f |
22 |
--- /dev/null |
23 |
+++ b/sys-apps/ipmitool/files/exchange-bmc-os-info-1.8.18.initd |
24 |
@@ -0,0 +1,23 @@ |
25 |
+#!/sbin/openrc-run |
26 |
+# Copyright 2020 Gentoo Authors |
27 |
+# Distributed under the terms of the GNU General Public License v2 |
28 |
+# /etc/init.d/exchange-bmc-os-info |
29 |
+ |
30 |
+name="exchange-bmc-os-info" |
31 |
+description="Exchange Information between BMC and OS" |
32 |
+command=/usr/libexec/exchange-bmc-os-info |
33 |
+command_args="" |
34 |
+: "${DEVICENUM:=0}" # which BMC |
35 |
+required_files=/dev/ipmi${DEVICENUM} |
36 |
+ |
37 |
+depend() { |
38 |
+ use hostname modules |
39 |
+ keyword -docker -lxc -prefix -systemd-nspawn |
40 |
+} |
41 |
+ |
42 |
+start() { |
43 |
+ "${command}" start |
44 |
+} |
45 |
+stop() { |
46 |
+ "${command}" stop |
47 |
+} |
48 |
|
49 |
diff --git a/sys-apps/ipmitool/files/ipmitool-1.8.18-ipmievd.confd b/sys-apps/ipmitool/files/ipmitool-1.8.18-ipmievd.confd |
50 |
new file mode 100644 |
51 |
index 00000000000..b860c23c7f8 |
52 |
--- /dev/null |
53 |
+++ b/sys-apps/ipmitool/files/ipmitool-1.8.18-ipmievd.confd |
54 |
@@ -0,0 +1,27 @@ |
55 |
+# Copyright 1999-2020 Gentoo Authors |
56 |
+# Distributed under the terms of the GNU General Public License v2 |
57 |
+# /etc/conf.d/ipmievd |
58 |
+ |
59 |
+# Interfaces: |
60 |
+# open Linux OpenIPMI Interface |
61 |
+# imb Intel IMB Interface |
62 |
+# bmc IPMI v2.0 BMC interface |
63 |
+# lan IPMI v1.5 LAN Interface |
64 |
+# lanplus IPMI v2.0 RMCP+ LAN Interface |
65 |
+ |
66 |
+INTERFACE="open" |
67 |
+ |
68 |
+# Commands: |
69 |
+# open Use OpenIPMI for asyncronous notification of events |
70 |
+# sel Poll SEL for notification of events |
71 |
+# |
72 |
+# 'pidfile=...' will be appended! |
73 |
+COMMAND="open daemon" |
74 |
+ |
75 |
+# Options. |
76 |
+ |
77 |
+OPTIONS="" |
78 |
+ |
79 |
+# Device number: |
80 |
+# Used to target a specific BMC on a multi-node, multi-BMC system via the open interface |
81 |
+DEVICENUM=0 |
82 |
|
83 |
diff --git a/sys-apps/ipmitool/files/ipmitool-1.8.18-ipmievd.initd b/sys-apps/ipmitool/files/ipmitool-1.8.18-ipmievd.initd |
84 |
new file mode 100644 |
85 |
index 00000000000..e8ef2c39d45 |
86 |
--- /dev/null |
87 |
+++ b/sys-apps/ipmitool/files/ipmitool-1.8.18-ipmievd.initd |
88 |
@@ -0,0 +1,28 @@ |
89 |
+#!/sbin/openrc-run |
90 |
+# Copyright 1999-2020 Gentoo Authors |
91 |
+# Distributed under the terms of the GNU General Public License v2 |
92 |
+# /etc/init.d/ipmievd |
93 |
+ |
94 |
+depend() { |
95 |
+ use logger modules |
96 |
+ keyword -docker -lxc -prefix -systemd-nspawn |
97 |
+} |
98 |
+ |
99 |
+# TODO: ipmievd has a mode where it could be used to monitor multiple BMCs via |
100 |
+# DEVICENUM or remote systems, and it would be valid to run multiple instances. |
101 |
+# That is not supported by this init script at this time. |
102 |
+ |
103 |
+description="IPMI event daemon for sending events to syslog LOCAL4" |
104 |
+ |
105 |
+: "${DEVICENUM:=0}" |
106 |
+: "${INTERFACE:=open}" |
107 |
+: "${COMMAND:=open daemon}" |
108 |
+: "${OPTIONS:=}" |
109 |
+ |
110 |
+daemon=ipmievd |
111 |
+ |
112 |
+pidfile=/run/${daemon}.pid${DEVICENUM} # see manpage re suffix |
113 |
+command=/usr/sbin/${daemon} |
114 |
+cachefile=/run/${daemon}.${DEVICENUM}.sdr-cache |
115 |
+command_args="-d ${DEVICENUM} -S ${cachefile} -I ${INTERFACE} ${OPTIONS} ${COMMAND} pidfile=${pidfile}" |
116 |
+required_files=/dev/ipmi$DEVICENUM |
117 |
|
118 |
diff --git a/sys-apps/ipmitool/files/log_bmc-1.8.18.initd b/sys-apps/ipmitool/files/log_bmc-1.8.18.initd |
119 |
new file mode 100644 |
120 |
index 00000000000..4064edf3b84 |
121 |
--- /dev/null |
122 |
+++ b/sys-apps/ipmitool/files/log_bmc-1.8.18.initd |
123 |
@@ -0,0 +1,25 @@ |
124 |
+#!/sbin/openrc-run |
125 |
+# Copyright 2020 Gentoo Authors |
126 |
+# Distributed under the terms of the GNU General Public License v2 |
127 |
+ |
128 |
+name="log_bmc" |
129 |
+description="Add SEL entries to indicate OS Boot status" |
130 |
+command=/usr/libexec/log_bmc.sh |
131 |
+command_args="" |
132 |
+: "${DEVICENUM:=0}" # which BMC |
133 |
+required_files=/dev/ipmi${DEVICENUM} |
134 |
+ |
135 |
+depend() { |
136 |
+ use modules |
137 |
+ after ipmievd # to capture our own log event |
138 |
+ keyword -docker -lxc -prefix -systemd-nspawn |
139 |
+} |
140 |
+ |
141 |
+start() { |
142 |
+ # TODO: should this keep start so it only fires once per boot? |
143 |
+ "${command}" os_boot |
144 |
+} |
145 |
+ |
146 |
+stop() { |
147 |
+ "${command}" os_shutdown |
148 |
+} |
149 |
|
150 |
diff --git a/sys-apps/ipmitool/ipmitool-1.8.18_p20201004-r2.ebuild b/sys-apps/ipmitool/ipmitool-1.8.18_p20201004-r2.ebuild |
151 |
new file mode 100644 |
152 |
index 00000000000..a5724717937 |
153 |
--- /dev/null |
154 |
+++ b/sys-apps/ipmitool/ipmitool-1.8.18_p20201004-r2.ebuild |
155 |
@@ -0,0 +1,200 @@ |
156 |
+# Copyright 1999-2020 Gentoo Authors |
157 |
+# Distributed under the terms of the GNU General Public License v2 |
158 |
+ |
159 |
+EAPI=7 |
160 |
+inherit autotools eutils flag-o-matic systemd |
161 |
+ |
162 |
+DESCRIPTION="Utility for controlling IPMI enabled devices." |
163 |
+HOMEPAGE="http://ipmitool.sf.net/" |
164 |
+DEBIAN_PR="9.debian" |
165 |
+DEBIAN_PV="${PV/_p*}" |
166 |
+DEBIAN_P="${PN}_${DEBIAN_PV}" |
167 |
+DEBIAN_PF="${DEBIAN_P}-${DEBIAN_PR}" |
168 |
+COMMIT_ID=7fd7c0f2ba39e223868a8d83d81d4074f057d6fc |
169 |
+if [[ -n "${COMMIT_ID}" ]]; then |
170 |
+ S="${WORKDIR}/${PN}-${COMMIT_ID}" |
171 |
+ SRC_URI="https://github.com/ipmitool/ipmitool/archive/${COMMIT_ID}.tar.gz -> ${P}.tar.gz" |
172 |
+else |
173 |
+ SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" |
174 |
+fi |
175 |
+# https://www.iana.org/assignments/enterprise-numbers/enterprise-numbers |
176 |
+# is not available with version numbers or dates! |
177 |
+SRC_URI+=" |
178 |
+ https://dev.gentoo.org/~robbat2/distfiles/ipmitool_1.8.18-9.debian-ported-gentoo.tar.xz |
179 |
+ https://dev.gentoo.org/~robbat2/distfiles/enterprise-numbers.2020-10-21.xz |
180 |
+ " |
181 |
+ #http://http.debian.net/debian/pool/main/i/${PN}/${DEBIAN_PF}.tar.xz |
182 |
+ # https://launchpad.net/ubuntu/+archive/primary/+files/${DEBIAN_PF}.tar.xz |
183 |
+#IUSE="freeipmi openipmi status" |
184 |
+IUSE="libressl openbmc openipmi static" |
185 |
+SLOT="0" |
186 |
+KEYWORDS="~amd64 ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~x86" |
187 |
+LICENSE="BSD" |
188 |
+ |
189 |
+RDEPEND=" |
190 |
+ !libressl? ( dev-libs/openssl:0= ) |
191 |
+ libressl? ( dev-libs/libressl:0= ) |
192 |
+ openbmc? ( sys-apps/systemd:0= ) |
193 |
+ sys-libs/readline:0=" |
194 |
+DEPEND="${RDEPEND} |
195 |
+ openipmi? ( sys-libs/openipmi ) |
196 |
+ virtual/os-headers" |
197 |
+ #freeipmi? ( sys-libs/freeipmi ) |
198 |
+# ipmitool CAN build against || ( sys-libs/openipmi sys-libs/freeipmi ) |
199 |
+# but it doesn't actually need either. |
200 |
+ |
201 |
+PATCHES=( |
202 |
+ #"${FILESDIR}"/${P}-openssl-1.1.patch |
203 |
+) |
204 |
+ |
205 |
+# I hope all of this will get MUCH cleaner if upstream will just make a new |
206 |
+# release! - robbat2 2020/10/21 |
207 |
+src_prepare() { |
208 |
+ default |
209 |
+ if [ -d "${S}"/debian ] ; then |
210 |
+ mv "${S}"/debian{,.package} |
211 |
+ ln -s "${WORKDIR}"/debian "${S}" |
212 |
+ eautoreconf |
213 |
+ # Upstream commit includes SOME of the debian changes, but not all of them |
214 |
+ sed -i \ |
215 |
+ -e '/^#/d' \ |
216 |
+ -e '/0120-openssl1.1.patch/d' \ |
217 |
+ debian/patches/series |
218 |
+ for p in $(cat debian/patches/series) ; do |
219 |
+ echo $p |
220 |
+ if ! nonfatal eapply -p1 debian/patches/$p ; then |
221 |
+ echo "failed $p" |
222 |
+ fail=1 |
223 |
+ fi |
224 |
+ done |
225 |
+ [[ $fail -eq 1 ]] && die "fail" |
226 |
+ fi |
227 |
+ pd="${WORKDIR}"/ipmitool_1.8.18-9.debian-ported-gentoo/ |
228 |
+ PATCHES=( |
229 |
+ #"${pd}"/0000.0120-openssl1.1.patch |
230 |
+ "${pd}"/0001.0100-fix_buf_overflow.patch |
231 |
+ "${pd}"/0002.0500-fix_CVE-2011-4339.patch |
232 |
+ "${pd}"/0003.0600-manpage_longlines.patch |
233 |
+ #"${pd}"/0004.0110-getpass-prototype.patch |
234 |
+ #"${pd}"/0005.0115-typo.patch |
235 |
+ "${pd}"/0006.0125-nvidia-iana.patch |
236 |
+ "${pd}"/0007.0615-manpage_typo.patch |
237 |
+ #"${pd}"/0008.0130-Correct_lanplus_segment_violation.patch |
238 |
+ "${pd}"/0009.0005-gcc10.patch |
239 |
+ #"${pd}"/0010.0010-utf8.patch |
240 |
+ ) |
241 |
+ for p in "${PATCHES[@]}" ; do |
242 |
+ eapply -p1 $p || die "failed $p" |
243 |
+ done |
244 |
+ |
245 |
+ # Gentoo chooses to install ipmitool in /usr/sbin |
246 |
+ # Where RedHat chooses /usr/bin |
247 |
+ sed -i -e \ |
248 |
+ 's,/usr/bin/ipmitool,/usr/sbin/ipmitool,g' \ |
249 |
+ "${S}"/contrib/* \ |
250 |
+ || die "sed bindir failed" |
251 |
+ |
252 |
+ # Consistent RUNSTATEDIR |
253 |
+ sed -i -e \ |
254 |
+ 's,/var/run,/run,g' \ |
255 |
+ "${S}/doc/ipmievd.8.in" \ |
256 |
+ "${S}"/contrib/* \ |
257 |
+ "${S}"/lib/helper.c \ |
258 |
+ "${S}"/src/ipmievd.c \ |
259 |
+ || die "sed /var/run failed" |
260 |
+ |
261 |
+ eautoreconf |
262 |
+ |
263 |
+ # If this file is not present, then ipmitool will try to download it during make install! |
264 |
+ cp -al \ |
265 |
+ "${WORKDIR}/enterprise-numbers.2020-10-21" \ |
266 |
+ "${S}"/enterprise-numbers \ |
267 |
+ || die "Could not place IANA enterprise-numbers" |
268 |
+} |
269 |
+ |
270 |
+src_configure() { |
271 |
+ # - LIPMI and BMC are the Solaris libs |
272 |
+ # - OpenIPMI is unconditionally enabled in the configure as there is compat |
273 |
+ # code that is used if the library itself is not available |
274 |
+ # FreeIPMI does build now, but is disabled until the other arches keyword it |
275 |
+ # `use_enable freeipmi intf-free` \ |
276 |
+ # --enable-ipmievd is now unconditional |
277 |
+ |
278 |
+ # for pidfiles, runstatedir not respected in all parts of code |
279 |
+ append-cppflags -D_PATH_VARRUN=/run/ |
280 |
+ |
281 |
+ # WGET & CURL are set to avoid network interaction, we manually inject the |
282 |
+ # IANA enterprise-numbers file instead. |
283 |
+ # |
284 |
+ # DEFAULT_INTF=open # default to OpenIPMI, do not take external input |
285 |
+ WGET=/bin/true \ |
286 |
+ CURL=/bin/true \ |
287 |
+ DEFAULT_INTF=open \ |
288 |
+ econf \ |
289 |
+ $(use_enable static) \ |
290 |
+ --enable-ipmishell \ |
291 |
+ --enable-intf-lan \ |
292 |
+ --enable-intf-usb \ |
293 |
+ $(use_enable openbmc intf-dbus) \ |
294 |
+ --enable-intf-lanplus \ |
295 |
+ --enable-intf-open \ |
296 |
+ --enable-intf-serial \ |
297 |
+ --disable-intf-bmc \ |
298 |
+ --disable-intf-dummy \ |
299 |
+ --disable-intf-free \ |
300 |
+ --disable-intf-imb \ |
301 |
+ --disable-intf-lipmi \ |
302 |
+ --disable-internal-md5 \ |
303 |
+ --with-kerneldir=/usr \ |
304 |
+ --bindir=/usr/sbin \ |
305 |
+ --runstatedir=/run \ |
306 |
+ CFLAGS="${CFLAGS}" |
307 |
+ |
308 |
+ # Fix linux/ipmi.h to compile properly. This is a hack since it doesn't |
309 |
+ # include the below file to define some things. |
310 |
+ echo "#include <asm/byteorder.h>" >>config.h |
311 |
+ |
312 |
+} |
313 |
+ |
314 |
+src_install() { |
315 |
+ emake DESTDIR="${D}" PACKAGE="${PF}" install |
316 |
+ rm -f "${D}"/usr/share/doc/${PF}/COPYING |
317 |
+ into /usr |
318 |
+ |
319 |
+ newinitd "${FILESDIR}"/${PN}-1.8.18-ipmievd.initd ipmievd |
320 |
+ newconfd "${FILESDIR}"/${PN}-1.8.18-ipmievd.confd ipmievd |
321 |
+ |
322 |
+ # Everything past this point is installing contrib/ |
323 |
+ dosbin contrib/bmclanconf |
324 |
+ |
325 |
+ exeinto /usr/libexec |
326 |
+ doexe contrib/log_bmc.sh |
327 |
+ newinitd "${FILESDIR}/log_bmc-1.8.18.initd" log_bmc |
328 |
+ |
329 |
+ # contrib/exchange-bmc-os-info.init.redhat |
330 |
+ # contrib/exchange-bmc-os-info.service.redhat |
331 |
+ # contrib/exchange-bmc-os-info.sysconf |
332 |
+ exeinto /usr/libexec |
333 |
+ newexe contrib/exchange-bmc-os-info.init.redhat exchange-bmc-os-info |
334 |
+ insinto /etc/sysconfig |
335 |
+ newins contrib/exchange-bmc-os-info.sysconf exchange-bmc-os-info |
336 |
+ systemd_newunit contrib/exchange-bmc-os-info.service.redhat exchange-bmc-os-info.service |
337 |
+ newinitd "${FILESDIR}/exchange-bmc-os-info-1.8.18.initd" exchange-bmc-os-info |
338 |
+ |
339 |
+ # contrib/bmc-snmp-proxy |
340 |
+ # contrib/bmc-snmp-proxy.service |
341 |
+ # contrib/bmc-snmp-proxy.sysconf |
342 |
+ exeinto /usr/libexec |
343 |
+ doexe contrib/bmc-snmp-proxy |
344 |
+ insinto /etc/sysconfig |
345 |
+ newins contrib/bmc-snmp-proxy.sysconf bmc-snmp-proxy |
346 |
+ systemd_dounit contrib/bmc-snmp-proxy.service |
347 |
+ # TODO: initd for bmc-snmp-proxy |
348 |
+ |
349 |
+ insinto /usr/share/${PN} |
350 |
+ doins contrib/oem_ibm_sel_map |
351 |
+ |
352 |
+ docinto contrib |
353 |
+ cd "${S}"/contrib |
354 |
+ dodoc collect_data.sh create_rrds.sh create_webpage_compact.sh create_webpage.sh README |
355 |
+} |