summaryrefslogtreecommitdiff
path: root/sys-power/nut
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-power/nut
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-power/nut')
-rw-r--r--sys-power/nut/Manifest24
-rw-r--r--sys-power/nut/files/lighttpd_nut.conf-2.2.022
-rw-r--r--sys-power/nut/files/nut-2.2.2-init.d-upsdrv43
-rw-r--r--sys-power/nut/files/nut-2.4.1-no-libdummy.patch18
-rw-r--r--sys-power/nut/files/nut-2.6.2-lowspeed-buffer-size.patch16
-rw-r--r--sys-power/nut/files/nut-2.6.3-CVE-2012-2944.patch21
-rw-r--r--sys-power/nut/files/nut-2.6.5-freeipmi_fru.patch448
-rw-r--r--sys-power/nut/files/nut-2.6.5-init.d-upsd37
-rw-r--r--sys-power/nut/files/nut-2.6.5-init.d-upslog30
-rw-r--r--sys-power/nut/files/nut-2.6.5-init.d-upsmon29
-rw-r--r--sys-power/nut/files/nut-2.7.1-fix-scanning.patch72
-rw-r--r--sys-power/nut/files/nut-2.7.1-snmpusb-order.patch37
-rw-r--r--sys-power/nut/files/nut-2.7.2/nut-2.7.2-no-libdummy.patch13
-rw-r--r--sys-power/nut/files/nut.powerfail.initd48
-rw-r--r--sys-power/nut/metadata.xml65
-rw-r--r--sys-power/nut/nut-2.6.5-r1.ebuild231
-rw-r--r--sys-power/nut/nut-2.7.2-r2.ebuild274
-rw-r--r--sys-power/nut/nut-2.7.3.ebuild269
-rw-r--r--sys-power/nut/nut-2.7.4.ebuild269
19 files changed, 1966 insertions, 0 deletions
diff --git a/sys-power/nut/Manifest b/sys-power/nut/Manifest
new file mode 100644
index 000000000000..226efa343eaa
--- /dev/null
+++ b/sys-power/nut/Manifest
@@ -0,0 +1,24 @@
+AUX lighttpd_nut.conf-2.2.0 852 SHA256 4a85bb15d88be7e4874f195e78d9bc1b0b11bbd4c017d2b7440a78f52581184b SHA512 3bdb8cf6823d06ff84fd85f4484be4d842ce4a06722ebe22d7ddd6ea1b78ea08411a7f4a62a31df1b697f5e687f7ee88c8c4872e6a5a05390cef4a46798a7f35 WHIRLPOOL d120055528abc378c2d0566feb21ad8d0ae816d19b2b76ff9fea1faad57dbd8011c6525bffb2e0c7fd15ef98dfa1b3f488600ae58b67a9468e16a8351beacedc
+AUX nut-2.2.2-init.d-upsdrv 859 SHA256 715a04dd7a72d88657722475bd198839a7583d63d5ae0cc94d89869fea15cdd0 SHA512 6ca718fcd0019420eabb4b69e3f24334872336be56c07b14c668813bf3d2b82f92903028d7d3142be743ed22d8dc94d7e471d9596710b9dbc1717e2576d3a8f3 WHIRLPOOL 40d5232ad9cc92c785661794956a720fc8b804a33c7af21d1834324f25f86e99693bd8ad2ed20121523febcfb70fbc37b8cf7a20934746309077e3d80c718a3a
+AUX nut-2.4.1-no-libdummy.patch 791 SHA256 c9cf34980e79a4b9f07c338d10bc4ef4e90608ee7543cbc483898ee4f3f4f2a4 SHA512 7dff9d2601fb400bc27fd49b18a2b5b4a8e8ab33af84c4a78b7091ac929eb3dc53550aaa88bd2eb5227c13b0e191dda137f5ddd71606748652505f89d540b84a WHIRLPOOL 8e621826d5797e8ffb63e55ff0ac76b25adaa1ac453921bb830ff4fd735f9d266df239884c59904764f87b1c86cd83372584f630030c28d5a5d48e47b7cae8b9
+AUX nut-2.6.2-lowspeed-buffer-size.patch 534 SHA256 77bc0f996d2eb9c3d7d0cf68f5053108df54a6ce6baf2d7b3edfd1f2cfafd41b SHA512 783a754871b55b40d745161c71bca851b5c6c8a72622d0b9ce17ef523e243ed41ff7bfbac33f19d8732b7a361b494fbf9f21669bac3816fe5f71a583e882a385 WHIRLPOOL 0dfcc0db960720a109cfe514be2559a88a500daeeefd304a8f69695607651e94c8387f8821b843bab0ce9eaf33f6d5ec8a09a425c1ed3fe44c6eb4ec3e9ef73b
+AUX nut-2.6.3-CVE-2012-2944.patch 736 SHA256 47101a0827cd3cb0eb119a79d58c26b2f065af2f44eaeae5139a85ef8cc83993 SHA512 00ff1cfd5fd60cf671df45f28da0adbfba2d9c2e48f05481abaff70d4a442196e75b8becc8d787cbd6710e7d5df3e09f1894a40cf70e4a1d3f41f32afefdfd3b WHIRLPOOL e9269a42cd940cfdaf85778fa9eaca9908228e52a7141e0a5325e3238ab222a9b26e28efbdd7b51c74b30299b255b196ab0552c3d32e46e7c19b5da1e60aba13
+AUX nut-2.6.5-freeipmi_fru.patch 17326 SHA256 a3907d5d02d097ab0f054fa4082d3472fd929787331a93c7e8c63a6a1fea8f88 SHA512 d24fb32a47585ef55aa2e8e4a301c9f5c6af6182d7c106965b7071b2a34a33c9805c63e43907fb77972c122391d22ee5eda9e8f9000eda6b7ad972415b254820 WHIRLPOOL 91886bfbebd243f2929abaf905965c23ada51ff6538ba299c619c7e6041f53ce29d2f83a7a7a441ea4ec0aada36c1eadcfc2f049a3877af346fbd624d46c2dd6
+AUX nut-2.6.5-init.d-upsd 671 SHA256 ba57cc38fc3a87994fcbd1b8a77aed6f3a6c5780f3eeaf38fc7c4c87efe66409 SHA512 79c36537fb40b8284afb8edc28afa0f98fdf96e8def0382278c6242b4602f1911e29a174825ee676f77aa609b6409ce3483a1d188354956d20be9862c4e78180 WHIRLPOOL 0ba4279414ae6557106f5826dc051fdd091e4e05ecf69a97a8563fbfccfcbf19a49ae374367f97d1bf47d5af05b2e25c83895da6deb51d7257f7e5b36b68e6c7
+AUX nut-2.6.5-init.d-upslog 573 SHA256 4462f84b3701ae8bb2f31cbc79b511f9c097f0cce109a8aa1847eeff7879786f SHA512 06ca7fa8f3fe729b07a919d2a0ecb573b8ac180c447f927504524fca18894e045492458271b9a15898861cb3839b9fb95b2c843e241c7148bc25331ab8360b36 WHIRLPOOL 390602788a4212500c3889716bcdda8d89f5a7a80ffda3f167ad021a17cc6778b52358aa46c4520d48d04e109f8e0b9498492bfe7569c0262f6c0ecbf1ad357a
+AUX nut-2.6.5-init.d-upsmon 557 SHA256 d190b77cee00c7469f8f3411ec63b1e12212b97baa0ae117da758cd54819cd7d SHA512 9ccf947b2c5e7a73e96148edb7684f21ae84c4212b980f2ba7b88006dc1e3400b1b9017202b87648f928a3e19f4898094622a6683e0995b72f355ccb394280c3 WHIRLPOOL 4884b6f45904780bb93128c7e995c73f956dc909af9703b1be9e41537bb27ad304192ae999d40a2fb72210cbb67b189f57bde71ac4a0699fcc90fc67060fc757
+AUX nut-2.7.1-fix-scanning.patch 2311 SHA256 32f375e084b8250bbcbbd402517ca720040e1bf5302e0f242c3ea6e0ad62665d SHA512 9695b77af0e2bfbec62f6b2686c6d2c65211a369d671907fcb191e0da7d9765f50587cf193a4fc0fbd12c6d8f4d5beb900dc4bb8dc04133bb1b01f078561de50 WHIRLPOOL 2aef54dd8b0b442f3e1e68b1b3018ea2431042e667e66450c2d737fc60c73de0600a221ac91489533b7758968087264af05ef41d1edda374bbb95aa6b31207fa
+AUX nut-2.7.1-snmpusb-order.patch 1417 SHA256 1f2d8bd74cebf61c711130046a8fee99d29fa482d2b1a235816c6348a16acd49 SHA512 df3701821bc4ef45a5089e4d4439c3367fb23cefce7d06168bd422a8c32a1b373ae9fb3456bd5f90a51a672edf9ce29254a08c2045efe210a11b82399793ec19 WHIRLPOOL 0904f346748d16336c57cfb10741aba6a2d0e76f988925e7479dc8ae742b5fcfdd09dce531e5d5743009593fd61e9810b505b24db2f15d8d37c0bebd912abfdb
+AUX nut-2.7.2/nut-2.7.2-no-libdummy.patch 535 SHA256 3412955defbf36999896e348569e994e4b89915fcf056e6448348b1209996647 SHA512 a402a70a4cfc922d31203560627ace87f82795aef072d333cb1bfb91a6b67fbc10769e5d68a8d2741ca512b81b5754e9141b68dcb197dbe558ed5556e2de37a1 WHIRLPOOL 0a5c0012c00a5db475e28405b1f60613bc487c1d7df89e5b6505f74cc4534a7bf5b500e5288be6a4bf10543150400d6f10568affe4df4663b508596cf20d4e07
+AUX nut.powerfail.initd 1306 SHA256 8d93892db050eef4d1cc7eeb0f79848529a4a7d084868f18a427735435044483 SHA512 b9aaab526d0996b36a7a6d76a3ee63c1452b0a1bed358e23f6f7f5534e0da7751281428091efc7dba2004706996850ec18318809fdacb94cd8d73ea22bda52ee WHIRLPOOL 3394c702bd322309610446072193ddaf3165b46f828b512082ccf9aa082b01d4440bc3f251ac733223ddbe9259868f8e1372b3bf0fb83f2d5b4999b9f92834f4
+DIST nut-2.6.5.tar.gz 2038832 SHA256 618df71cf1ca6e3700d1d3c282773a2dec85f9f20324c0d3234c824e97feb93f SHA512 f1c76e6280057dc558d53451e7de2bdc7f37a0f175b1c52c27e7dcb83deeb78f6885007ad188a7a3a19e411eba87e03eb2246310bd7a5a5bb6fa3ad2bebd49d8 WHIRLPOOL 2b189f77d18d26303c60f2c084796075b0a50b8aa9cbefc3ba9a83f037450ffc3ecdb289367435e784a6bbe8569f768a97130a1ccdf123e53f13e0cf8813fb9a
+DIST nut-2.7.2.tar.gz 2223307 SHA256 4d5365359b059d96dfcb77458f361a114d26c84f1297ffcd0c6c166f7200376d SHA512 7d6b44e8f2d03544d9825274f4f3039911e335eb51620ded3dc08d51aeb096281c2ec848831815c54eecd4f2a25bdb1e6e5f479422e5291f03c3055da7ba52e6 WHIRLPOOL 6e7c45ef09fc2e86f0b79787043a9bf9954b5ef57fb16f9d453734680ff947abd8fb6665c5da4dac09850f5ab6a414039aa067803ecdeb2efd8537b8909f1ff9
+DIST nut-2.7.3.tar.gz 2317478 SHA256 ff44d95d06a51559a0a018eef7f8d17911c1002b6352a7d7580ff75acb12126b SHA512 3dd978712dc0fabe7e194dbf6d7bb442c456aa4d45bfc63ede8a3acae23c66811cbcf2705b55a6739129b5f120e6f5865bcb9d19eb9080507a85e2624d5663d6 WHIRLPOOL d9fe0c6545808a7daa25c45bd4f43fba1071cec0fd668d66b7926b6cd7af55e0d8c937bcdbb41e693f977c960c4e2ea95ff40d35b5f68695da5a7d1fc8da7265
+DIST nut-2.7.4.tar.gz 2509831 SHA256 980e82918c52d364605c0703a5dcf01f74ad2ef06e3d365949e43b7d406d25a7 SHA512 320c4aff85d8a370c5eff77d33924fdfc3caf6a250620693cdd5bf3336b3a80d8a207488eee841bcf8b72fbad68fda4c074e63b99c56e7886716fc934122d11a WHIRLPOOL 79b2ad8d2bc1211ba67bb24fec77b61e93b62d3854d5fd908083ff061bcc247abbda8dbf27259d1c38fb6fbeeaf8db65c620b8b3fc4029f14c03b12855925178
+EBUILD nut-2.6.5-r1.ebuild 7233 SHA256 1b1c4d976d01c0a73894d9d6bfc439f09471261855ad95171284ac7a353edd4b SHA512 fc7ef6a8c701374a1e98fb61b2064bddbfb0b9195d7d54ba9a408d76c862b207d0f72f03fd1775e84c3a41ac513a780e0a97420c813b98e541842e55712203ef WHIRLPOOL 53c80d7369d56ce597d9418f865ac7ffa7927133fadeb04da41a3e35bc97856634effd772929b3a548215ca1234803d2018cfa7cc455f00a93391c01f61bb172
+EBUILD nut-2.7.2-r2.ebuild 9349 SHA256 8f5498f20ada809baa4e344811b59647e021da7a4972a2ff3858b9202b6f3079 SHA512 143239b51ff5db0c74b6ee7bb619c9c5c96b9c5bfa2a7883e8d004dbc5fb302462c9304f3131650b7d06fa7a10317881feba15f6279299f963a6e99d6ec81d10 WHIRLPOOL aca11edf3b241a7b87c4e9491c25f31c1bd76e790c193e7ceb7c0dc05ddfb3dfd0a60548c5230066c1140a7ff4fd8a40e6759b2c2608939cbea0e03a8a6b56f0
+EBUILD nut-2.7.3.ebuild 9138 SHA256 c5e0121e42b221fb2dd83b7e06025ff6ee7add86befce7046568cf8f76de7dbb SHA512 3123230597b9fd6ddaf25094409a20628adfb7c2ce704e32a7f082e137c3da37e28009f81d90983f759ea741eadd5672166dff7661cb432ad6ecf26303a3c4ea WHIRLPOOL 19ac6b5c96bb18d080ef26fb02805e290d3bb8893ba9136aa4e07b10d3003f503218ceb9fd89bcef83ed056b4a0f00a4ab93795d7073ba3515d6578f8563ac0b
+EBUILD nut-2.7.4.ebuild 9144 SHA256 09151747accea61ad565103b3cc84c0a40b78c09014590d52e1dc6601633508d SHA512 21c6738218cf0160693a3459b9ae62becc6119a9b0cb87bd21eb46094b2feb135bda479acefe250abd6dfc79faa2508101e1113c86fa6ef66ce8d522d26ee924 WHIRLPOOL ad857f304901cbe5248a1ee996e75bf983584bfcf32facaee7a895905fb5a001eb5e4d2d69f085c002d3db147f6cd8217efe138777e84f47039569e1444df5da
+MISC ChangeLog 4054 SHA256 553e51884beadfdd2b8cfb3a476e9e522dd5ea2083ce5fcfc10a9b3ae0d51b51 SHA512 57c0386f060afeb78e78e2cabc53f12f67af4813c697654f6bc96b88ec29c57f0101982822c8ecdd8628eaea83a2077a62e592a6e48437cd94568b365f18541d WHIRLPOOL f0b1b9e2f71a9a34058b0c493a156c0b46f8e66e85ac8176eb46be01b6204a3bbf4b1a9f9fa290a8e8b31dae2d55b7e37f7ce45bb9041738d7089ac222ae14e1
+MISC ChangeLog-2015 24865 SHA256 849f81c077afebae42c09e56c7b34cf9bbdd25fd6483c234c2d24ae9cebe4dec SHA512 39cf958b542c47a35aa44a988ea72b49abda6dcaeae43c8fcfc25a7719a2d7f02e6ad8ac90e6312a5de8565a2f7e38ace552fb72e39397ded46fc82e6dfd6142 WHIRLPOOL ff6ed27721775e1ed82ce367c3d27b2e1981eabebb144ef672fc985cbd9da133fc48df9f55233781a40f123b43d0ab4ca3423ba03f9e815f7b5433e10c8f8212
+MISC metadata.xml 5080 SHA256 60a521b82734c8a69443aa536adffab93addce0c43b7bb2c511fadfade5c0fde SHA512 12ea51c0846cf7fb7a086d103ed097e539bd4d80153a5411057c53b64fddd4a7e3db611150bf3770ecef9ca9ca905b79f105106d1b7980e7f91343e724e297e5 WHIRLPOOL 2c8d526020e5c652044f0cb49eee9ac874fd9f52746a597f2fd449e6423083c2dac05cb114e91c9d2d44a2f60a4aff6305ee84f47ea01180c00df8a14eb1fcc8
diff --git a/sys-power/nut/files/lighttpd_nut.conf-2.2.0 b/sys-power/nut/files/lighttpd_nut.conf-2.2.0
new file mode 100644
index 000000000000..434be8c87e61
--- /dev/null
+++ b/sys-power/nut/files/lighttpd_nut.conf-2.2.0
@@ -0,0 +1,22 @@
+###############################################################################
+# Lighttpd configuration for using NUT under Gentoo Linux.
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+###############################################################################
+
+# Simple copy this to /etc/lighttpd/ and include it in your lighttpd.conf.
+# It will make NUT available at http://$HOST/nut/
+
+server.modules += ("mod_cgi")
+
+# If you want to limit it to some host, uncomment the host check and modify it to your needs.
+# $HTTP["host"] == "www2.example.org" {
+alias.url += ( "/nut/" => "/usr/share/nut/cgi/" )
+$HTTP["url"] =~ "^/nut/" {
+ dir-listing.activate = "disable"
+ cgi.assign = ( ".cgi" => "" )
+ index-file.names = ( "upsstats.cgi" )
+}
+# }
+
+# vim: set ft=conf foldmethod=marker et :
diff --git a/sys-power/nut/files/nut-2.2.2-init.d-upsdrv b/sys-power/nut/files/nut-2.2.2-init.d-upsdrv
new file mode 100644
index 000000000000..9b49ee395568
--- /dev/null
+++ b/sys-power/nut/files/nut-2.2.2-init.d-upsdrv
@@ -0,0 +1,43 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="stopall startall"
+
+UPSNAME=${SVCNAME#*.}
+msgtext="drivers"
+[ "${UPSNAME}" = "${SVCNAME}" ] && UPSNAME=''
+[ -n "$UPSNAME" ] && msgtext="driver for $UPSNAME"
+
+depend() {
+ before upsd
+ [ "${UPSNAME}" != '' ] && provide upsdrv
+}
+
+start() {
+ _dostart "$UPSNAME" "$msgtext"
+}
+stop() {
+ _dostop "$UPSNAME" "$msgtext"
+}
+
+startall() {
+ _dostart "" "$msgtext"
+}
+stopall() {
+ _dostop "" "$msgtext"
+}
+
+_dostart() {
+ ebegin "Starting UPS $msgtext"
+ /usr/sbin/upsdrvctl start $UPSNAME
+ eend $? "Failed to start UPS $msgtext!"
+}
+
+_dostop() {
+ # The pidfile names depend on the actual UPS name
+ # Not in our control at all
+ ebegin "Stopping UPS $msgtext"
+ /usr/sbin/upsdrvctl stop $UPSNAME
+ eend $? "Failed to stop UPS $msgtext!"
+}
diff --git a/sys-power/nut/files/nut-2.4.1-no-libdummy.patch b/sys-power/nut/files/nut-2.4.1-no-libdummy.patch
new file mode 100644
index 000000000000..31a8e73e54f1
--- /dev/null
+++ b/sys-power/nut/files/nut-2.4.1-no-libdummy.patch
@@ -0,0 +1,18 @@
+diff -Nuar nut-2.4.1.orig/drivers/Makefile.am nut-2.4.1/drivers/Makefile.am
+--- nut-2.4.1.orig/drivers/Makefile.am 2008-07-04 20:12:38.201211819 -0700
++++ nut-2.4.1/drivers/Makefile.am 2008-07-04 20:12:59.829462787 -0700
+@@ -211,10 +211,12 @@
+ upscode2.h victronups.h powerpanel.h powerp-bin.h powerp-txt.h \
+ upshandler.h netxml-ups.h mge-xml.h
+
++EXTRA_LIBRARIES =
++
+ # Define a dummy library so that Automake builds rules for the
+ # corresponding object files. This library is not actually built,
+-EXTRA_LIBRARIES = libdummy.a
+-libdummy_a_SOURCES = main.c dstate.c serial.c
++#EXTRA_LIBRARIES += libdummy.a
++#libdummy_a_SOURCES = main.c dstate.c serial.c
+
+ # the nuthalmain library combines the code for main-hal.c and
+ # dstate-hal.c. It is necessary for Automake-technical reasons,
diff --git a/sys-power/nut/files/nut-2.6.2-lowspeed-buffer-size.patch b/sys-power/nut/files/nut-2.6.2-lowspeed-buffer-size.patch
new file mode 100644
index 000000000000..9806d07e53ba
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.2-lowspeed-buffer-size.patch
@@ -0,0 +1,16 @@
+http://bugs.gentoo.org/show_bug.cgi?id=318937
+http://boxster.ghz.cc/projects/nut/changeset/2407
+
+Respun from nut-2.4.3-lowspeed-buffer-size.patch
+
+Index: /trunk/drivers/libhid.c
+===================================================================
+--- /trunk/drivers/libhid.c (revision 2336)
++++ /trunk/drivers/libhid.c (revision 2407)
+@@ -142,5 +142,5 @@
+ int id = pData->ReportID;
+ int r;
+- unsigned char buf[SMALLBUF];
++ unsigned char buf[8]; /* Maximum size for low-speed USB devices */
+
+ if (rbuf->ts[id] + age > time(NULL)) {
diff --git a/sys-power/nut/files/nut-2.6.3-CVE-2012-2944.patch b/sys-power/nut/files/nut-2.6.3-CVE-2012-2944.patch
new file mode 100644
index 000000000000..9debd3b9da3f
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.3-CVE-2012-2944.patch
@@ -0,0 +1,21 @@
+Origin: http://trac.networkupstools.org/projects/nut/changeset/3633
+Description: Fix CVE-2012-2944: upsd can be remotely crashed
+
+Index: nut-2.6.3/common/parseconf.c
+===================================================================
+--- nut-2.6.3.orig/common/parseconf.c 2011-10-04 02:06:25.000000000 -0500
++++ nut-2.6.3/common/parseconf.c 2012-05-30 13:29:41.000000000 -0500
+@@ -171,6 +171,13 @@
+
+ wbuflen = strlen(ctx->wordbuf);
+
++ /* CVE-2012-2944: only allow the subset Ascii charset from Space to ~ */
++ if ((ctx->ch < 0x20) || (ctx->ch > 0x7f)) {
++ fprintf(stderr, "addchar: discarding invalid character (0x%02x)!\n",
++ ctx->ch);
++ return;
++ }
++
+ if (ctx->wordlen_limit != 0) {
+ if (wbuflen >= ctx->wordlen_limit) {
+
diff --git a/sys-power/nut/files/nut-2.6.5-freeipmi_fru.patch b/sys-power/nut/files/nut-2.6.5-freeipmi_fru.patch
new file mode 100644
index 000000000000..96ac91d0a48c
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-freeipmi_fru.patch
@@ -0,0 +1,448 @@
+Update to 1.2.x ipmi_fru declarations.
+
+Starting with the 1.2.1 release, all of the ipmi_fru_parse* declarations (both
+lowercase & uppercase) were renamed to ipmi_fru*. This is a simple search &
+replace of all instances. Upstream should probably have a backwards compatible
+version that supports both variants of the names.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar nut-2.6.5.orig/drivers/nut-libfreeipmi.c nut-2.6.5/drivers/nut-libfreeipmi.c
+--- nut-2.6.5.orig/drivers/nut-libfreeipmi.c 2012-07-31 17:38:59.000000000 +0000
++++ nut-2.6.5/drivers/nut-libfreeipmi.c 2013-08-12 17:55:03.132363518 +0000
+@@ -57,7 +57,7 @@
+
+ /* FreeIPMI contexts and configuration*/
+ ipmi_ctx_t ipmi_ctx = NULL;
+-ipmi_fru_parse_ctx_t fru_parse_ctx = NULL;
++ipmi_fru_ctx_t fru_parse_ctx = NULL;
+ ipmi_monitoring_ctx_t mon_ctx = NULL;
+ struct ipmi_monitoring_ipmi_config ipmi_config;
+ /* SDR management API has changed with 1.1.X and later */
+@@ -78,7 +78,7 @@
+
+ /* Support functions */
+ static const char* libfreeipmi_getfield (uint8_t language_code,
+- ipmi_fru_parse_field_t *field);
++ ipmi_fru_field_t *field);
+
+ static void libfreeipmi_cleanup();
+
+@@ -97,7 +97,7 @@
+ int nut_ipmi_open(int ipmi_id, IPMIDevice_t *ipmi_dev)
+ {
+ int ret = -1;
+- uint8_t areabuf[IPMI_FRU_PARSE_AREA_SIZE_MAX+1];
++ uint8_t areabuf[IPMI_FRU_AREA_SIZE_MAX+1];
+ unsigned int area_type = 0;
+ unsigned int area_length = 0;
+
+@@ -134,26 +134,26 @@
+ upsdebugx(1, "FreeIPMI initialized...");
+
+ /* Parse FRU information */
+- if (!(fru_parse_ctx = ipmi_fru_parse_ctx_create (ipmi_ctx)))
++ if (!(fru_parse_ctx = ipmi_fru_ctx_create (ipmi_ctx)))
+ {
+ libfreeipmi_cleanup();
+- fatal_with_errno(EXIT_FAILURE, "ipmi_fru_parse_ctx_create()");
++ fatal_with_errno(EXIT_FAILURE, "ipmi_fru_ctx_create()");
+ }
+
+ /* lots of motherboards calculate checksums incorrectly */
+- if (ipmi_fru_parse_ctx_set_flags (fru_parse_ctx, IPMI_FRU_PARSE_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
++ if (ipmi_fru_ctx_set_flags (fru_parse_ctx, IPMI_FRU_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
+ {
+ libfreeipmi_cleanup();
+- fatalx(EXIT_FAILURE, "ipmi_fru_parse_ctx_set_flags: %s\n",
+- ipmi_fru_parse_ctx_strerror (ipmi_fru_parse_ctx_errnum (fru_parse_ctx)));
++ fatalx(EXIT_FAILURE, "ipmi_fru_ctx_set_flags: %s\n",
++ ipmi_fru_ctx_strerror (ipmi_fru_ctx_errnum (fru_parse_ctx)));
+ }
+
+ /* Now open the requested (local) PSU */
+- if (ipmi_fru_parse_open_device_id (fru_parse_ctx, ipmi_id) < 0)
++ if (ipmi_fru_open_device_id (fru_parse_ctx, ipmi_id) < 0)
+ {
+ libfreeipmi_cleanup();
+- fatalx(EXIT_FAILURE, "ipmi_fru_parse_open_device_id: %s\n",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ fatalx(EXIT_FAILURE, "ipmi_fru_open_device_id: %s\n",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+
+ /* Set IPMI identifier */
+@@ -164,19 +164,19 @@
+ /* clear fields */
+ area_type = 0;
+ area_length = 0;
+- memset (areabuf, '\0', IPMI_FRU_PARSE_AREA_SIZE_MAX + 1);
++ memset (areabuf, '\0', IPMI_FRU_AREA_SIZE_MAX + 1);
+
+ /* parse FRU buffer */
+- if (ipmi_fru_parse_read_data_area (fru_parse_ctx,
++ if (ipmi_fru_read_data_area (fru_parse_ctx,
+ &area_type,
+ &area_length,
+ areabuf,
+- IPMI_FRU_PARSE_AREA_SIZE_MAX) < 0)
++ IPMI_FRU_AREA_SIZE_MAX) < 0)
+ {
+ libfreeipmi_cleanup();
+ fatal_with_errno(EXIT_FAILURE,
+- "ipmi_fru_parse_open_device_id: %s\n",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ "ipmi_fru_open_device_id: %s\n",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+
+ if (area_length)
+@@ -184,7 +184,7 @@
+ switch (area_type)
+ {
+ /* get generic board information */
+- case IPMI_FRU_PARSE_AREA_TYPE_BOARD_INFO_AREA:
++ case IPMI_FRU_AREA_TYPE_BOARD_INFO_AREA:
+
+ if(libfreeipmi_get_board_info (areabuf, area_length,
+ ipmi_dev) < 0)
+@@ -193,7 +193,7 @@
+ }
+ break;
+ /* get specific PSU information */
+- case IPMI_FRU_PARSE_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION:
++ case IPMI_FRU_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION:
+
+ if(libfreeipmi_get_psu_info (areabuf, area_length, ipmi_dev) < 0)
+ {
+@@ -205,13 +205,13 @@
+ break;
+ }
+ }
+- } while ((ret = ipmi_fru_parse_next (fru_parse_ctx)) == 1);
++ } while ((ret = ipmi_fru_next (fru_parse_ctx)) == 1);
+
+ /* check for errors */
+ if (ret < 0) {
+ libfreeipmi_cleanup();
+- fatal_with_errno(EXIT_FAILURE, "ipmi_fru_parse_next: %s",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ fatal_with_errno(EXIT_FAILURE, "ipmi_fru_next: %s",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+ else {
+ /* Get all related sensors information */
+@@ -232,25 +232,25 @@
+ }
+
+ static const char* libfreeipmi_getfield (uint8_t language_code,
+- ipmi_fru_parse_field_t *field)
++ ipmi_fru_field_t *field)
+ {
+- static char strbuf[IPMI_FRU_PARSE_AREA_STRING_MAX + 1];
+- unsigned int strbuflen = IPMI_FRU_PARSE_AREA_STRING_MAX;
++ static char strbuf[IPMI_FRU_AREA_STRING_MAX + 1];
++ unsigned int strbuflen = IPMI_FRU_AREA_STRING_MAX;
+
+ if (!field->type_length_field_length)
+ return NULL;
+
+- memset (strbuf, '\0', IPMI_FRU_PARSE_AREA_STRING_MAX + 1);
++ memset (strbuf, '\0', IPMI_FRU_AREA_STRING_MAX + 1);
+
+- if (ipmi_fru_parse_type_length_field_to_string (fru_parse_ctx,
++ if (ipmi_fru_type_length_field_to_string (fru_parse_ctx,
+ field->type_length_field,
+ field->type_length_field_length,
+ language_code,
+ strbuf,
+ &strbuflen) < 0)
+ {
+- upsdebugx (2, "ipmi_fru_parse_type_length_field_to_string: %s",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ upsdebugx (2, "ipmi_fru_type_length_field_to_string: %s",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ return NULL;
+ }
+
+@@ -280,8 +280,8 @@
+ {
+ /* cleanup */
+ if (fru_parse_ctx) {
+- ipmi_fru_parse_close_device_id (fru_parse_ctx);
+- ipmi_fru_parse_ctx_destroy (fru_parse_ctx);
++ ipmi_fru_close_device_id (fru_parse_ctx);
++ ipmi_fru_ctx_destroy (fru_parse_ctx);
+ }
+
+ #ifdef HAVE_FREEIPMI_11X_12X
+@@ -342,7 +342,7 @@
+
+ upsdebugx(1, "entering libfreeipmi_get_psu_info()");
+
+- if (ipmi_fru_parse_multirecord_power_supply_information (fru_parse_ctx,
++ if (ipmi_fru_multirecord_power_supply_information (fru_parse_ctx,
+ areabuf,
+ area_length,
+ &overall_capacity,
+@@ -368,8 +368,8 @@
+ &total_combined_wattage,
+ &predictive_fail_tachometer_lower_threshold) < 0)
+ {
+- fatalx(EXIT_FAILURE, "ipmi_fru_parse_multirecord_power_supply_information: %s",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ fatalx(EXIT_FAILURE, "ipmi_fru_multirecord_power_supply_information: %s",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+
+ ipmi_dev->overall_capacity = overall_capacity;
+@@ -392,12 +392,12 @@
+ {
+ uint8_t language_code;
+ uint32_t mfg_date_time;
+- ipmi_fru_parse_field_t board_manufacturer;
+- ipmi_fru_parse_field_t board_product_name;
+- ipmi_fru_parse_field_t board_serial_number;
+- ipmi_fru_parse_field_t board_part_number;
+- ipmi_fru_parse_field_t board_fru_file_id;
+- ipmi_fru_parse_field_t board_custom_fields[IPMI_FRU_CUSTOM_FIELDS];
++ ipmi_fru_field_t board_manufacturer;
++ ipmi_fru_field_t board_product_name;
++ ipmi_fru_field_t board_serial_number;
++ ipmi_fru_field_t board_part_number;
++ ipmi_fru_field_t board_fru_file_id;
++ ipmi_fru_field_t board_custom_fields[IPMI_FRU_CUSTOM_FIELDS];
+ const char *string = NULL;
+ time_t timetmp;
+ struct tm mfg_date_time_tm;
+@@ -406,15 +406,15 @@
+ upsdebugx(1, "entering libfreeipmi_get_board_info()");
+
+ /* clear fields */
+- memset (&board_manufacturer, '\0', sizeof (ipmi_fru_parse_field_t));
+- memset (&board_product_name, '\0', sizeof (ipmi_fru_parse_field_t));
+- memset (&board_serial_number, '\0', sizeof (ipmi_fru_parse_field_t));
+- memset (&board_fru_file_id, '\0', sizeof (ipmi_fru_parse_field_t));
++ memset (&board_manufacturer, '\0', sizeof (ipmi_fru_field_t));
++ memset (&board_product_name, '\0', sizeof (ipmi_fru_field_t));
++ memset (&board_serial_number, '\0', sizeof (ipmi_fru_field_t));
++ memset (&board_fru_file_id, '\0', sizeof (ipmi_fru_field_t));
+ memset (&board_custom_fields[0], '\0',
+- sizeof (ipmi_fru_parse_field_t) * IPMI_FRU_CUSTOM_FIELDS);
++ sizeof (ipmi_fru_field_t) * IPMI_FRU_CUSTOM_FIELDS);
+
+ /* parse FRU buffer */
+- if (ipmi_fru_parse_board_info_area (fru_parse_ctx,
++ if (ipmi_fru_board_info_area (fru_parse_ctx,
+ areabuf,
+ area_length,
+ &language_code,
+@@ -428,8 +428,8 @@
+ IPMI_FRU_CUSTOM_FIELDS) < 0)
+ {
+ libfreeipmi_cleanup();
+- fatalx(EXIT_FAILURE, "ipmi_fru_parse_board_info_area: %s",
+- ipmi_fru_parse_ctx_errormsg (fru_parse_ctx));
++ fatalx(EXIT_FAILURE, "ipmi_fru_board_info_area: %s",
++ ipmi_fru_ctx_errormsg (fru_parse_ctx));
+ }
+
+
+diff -Nuar nut-2.6.5.orig/m4/nut_check_libfreeipmi.m4 nut-2.6.5/m4/nut_check_libfreeipmi.m4
+--- nut-2.6.5.orig/m4/nut_check_libfreeipmi.m4 2012-07-31 17:38:56.000000000 +0000
++++ nut-2.6.5/m4/nut_check_libfreeipmi.m4 2013-08-12 17:55:03.132363518 +0000
+@@ -66,7 +66,7 @@
+ dnl when version cannot be tested (prior to 1.0.5, with no pkg-config)
+ dnl we have to check for some specific functions
+ AC_SEARCH_LIBS([ipmi_ctx_find_inband], [freeipmi], [], [nut_have_freeipmi=no])
+- AC_SEARCH_LIBS([ipmi_fru_parse_ctx_create], [freeipmi], [], [nut_have_freeipmi=no])
++ AC_SEARCH_LIBS([ipmi_fru_ctx_create], [freeipmi], [], [nut_have_freeipmi=no])
+
+ AC_SEARCH_LIBS([ipmi_monitoring_init], [ipmimonitoring], [nut_have_freeipmi_monitoring=yes], [nut_have_freeipmi_monitoring=no])
+ AC_SEARCH_LIBS([ipmi_monitoring_sensor_read_record_id], [ipmimonitoring], [], [nut_have_freeipmi_monitoring=no])
+diff -Nuar nut-2.6.5.orig/tools/nut-scanner/scan_ipmi.c nut-2.6.5/tools/nut-scanner/scan_ipmi.c
+--- nut-2.6.5.orig/tools/nut-scanner/scan_ipmi.c 2012-07-31 17:38:58.000000000 +0000
++++ nut-2.6.5/tools/nut-scanner/scan_ipmi.c 2013-08-12 17:55:03.132363518 +0000
+@@ -34,24 +34,24 @@
+ static lt_dlhandle dl_handle = NULL;
+ static const char *dl_error = NULL;
+
+-static int (*nut_ipmi_fru_parse_close_device_id) (ipmi_fru_parse_ctx_t ctx);
+-static void (*nut_ipmi_fru_parse_ctx_destroy) (ipmi_fru_parse_ctx_t ctx);
++static int (*nut_ipmi_fru_close_device_id) (ipmi_fru_ctx_t ctx);
++static void (*nut_ipmi_fru_ctx_destroy) (ipmi_fru_ctx_t ctx);
+ #ifdef HAVE_FREEIPMI_11X_12X
+ static void (*nut_ipmi_sdr_ctx_destroy) (ipmi_sdr_ctx_t ctx);
+ #else /* HAVE_FREEIPMI_11X_12X */
+ static void (*nut_ipmi_sdr_cache_ctx_destroy) (ipmi_sdr_cache_ctx_t ctx);
+ static void (*nut_ipmi_sdr_parse_ctx_destroy) (ipmi_sdr_parse_ctx_t ctx);
+ #endif /* HAVE_FREEIPMI_11X_12X */
+-static ipmi_fru_parse_ctx_t (*nut_ipmi_fru_parse_ctx_create) (ipmi_ctx_t ipmi_ctx);
+-static int (*nut_ipmi_fru_parse_ctx_set_flags) (ipmi_fru_parse_ctx_t ctx, unsigned int flags);
+-static int (*nut_ipmi_fru_parse_open_device_id) (ipmi_fru_parse_ctx_t ctx, uint8_t fru_device_id);
+-static char * (*nut_ipmi_fru_parse_ctx_errormsg) (ipmi_fru_parse_ctx_t ctx);
+-static int (*nut_ipmi_fru_parse_read_data_area) (ipmi_fru_parse_ctx_t ctx,
++static ipmi_fru_ctx_t (*nut_ipmi_fru_ctx_create) (ipmi_ctx_t ipmi_ctx);
++static int (*nut_ipmi_fru_ctx_set_flags) (ipmi_fru_ctx_t ctx, unsigned int flags);
++static int (*nut_ipmi_fru_open_device_id) (ipmi_fru_ctx_t ctx, uint8_t fru_device_id);
++static char * (*nut_ipmi_fru_ctx_errormsg) (ipmi_fru_ctx_t ctx);
++static int (*nut_ipmi_fru_read_data_area) (ipmi_fru_ctx_t ctx,
+ unsigned int *area_type,
+ unsigned int *area_length,
+ void *areabuf,
+ unsigned int areabuflen);
+-static int (*nut_ipmi_fru_parse_next) (ipmi_fru_parse_ctx_t ctx);
++static int (*nut_ipmi_fru_next) (ipmi_fru_ctx_t ctx);
+ static ipmi_ctx_t (*nut_ipmi_ctx_create) (void);
+ static int (*nut_ipmi_ctx_find_inband) (ipmi_ctx_t ctx,
+ ipmi_driver_type_t *driver_type,
+@@ -92,12 +92,12 @@
+ /* Clear any existing error */
+ lt_dlerror();
+
+- *(void **) (&nut_ipmi_fru_parse_close_device_id) = lt_dlsym(dl_handle, "ipmi_fru_parse_close_device_id");
++ *(void **) (&nut_ipmi_fru_close_device_id) = lt_dlsym(dl_handle, "ipmi_fru_close_device_id");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_ctx_destroy) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_destroy");
++ *(void **) (&nut_ipmi_fru_ctx_destroy) = lt_dlsym(dl_handle, "ipmi_fru_ctx_destroy");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+@@ -122,32 +122,32 @@
+ }
+ #endif /* HAVE_FREEIPMI_11X_12X */
+
+- *(void **) (&nut_ipmi_fru_parse_ctx_create) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_create");
++ *(void **) (&nut_ipmi_fru_ctx_create) = lt_dlsym(dl_handle, "ipmi_fru_ctx_create");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_ctx_set_flags) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_set_flags");
++ *(void **) (&nut_ipmi_fru_ctx_set_flags) = lt_dlsym(dl_handle, "ipmi_fru_ctx_set_flags");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_open_device_id) = lt_dlsym(dl_handle, "ipmi_fru_parse_open_device_id");
++ *(void **) (&nut_ipmi_fru_open_device_id) = lt_dlsym(dl_handle, "ipmi_fru_open_device_id");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_ctx_errormsg) = lt_dlsym(dl_handle, "ipmi_fru_parse_ctx_errormsg");
++ *(void **) (&nut_ipmi_fru_ctx_errormsg) = lt_dlsym(dl_handle, "ipmi_fru_ctx_errormsg");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_read_data_area) = lt_dlsym(dl_handle, "ipmi_fru_parse_read_data_area");
++ *(void **) (&nut_ipmi_fru_read_data_area) = lt_dlsym(dl_handle, "ipmi_fru_read_data_area");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
+- *(void **) (&nut_ipmi_fru_parse_next) = lt_dlsym(dl_handle, "ipmi_fru_parse_next");
++ *(void **) (&nut_ipmi_fru_next) = lt_dlsym(dl_handle, "ipmi_fru_next");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+@@ -188,17 +188,17 @@
+
+ /* Cleanup IPMI contexts */
+ #ifdef HAVE_FREEIPMI_11X_12X
+-static void nut_freeipmi_cleanup(ipmi_fru_parse_ctx_t fru_parse_ctx,
++static void nut_freeipmi_cleanup(ipmi_fru_ctx_t fru_parse_ctx,
+ ipmi_sdr_ctx_t sdr_ctx)
+ #else /* HAVE_FREEIPMI_11X_12X */
+-static void nut_freeipmi_cleanup(ipmi_fru_parse_ctx_t fru_parse_ctx,
++static void nut_freeipmi_cleanup(ipmi_fru_ctx_t fru_parse_ctx,
+ ipmi_sdr_cache_ctx_t sdr_cache_ctx,
+ ipmi_sdr_parse_ctx_t sdr_parse_ctx)
+ #endif /* HAVE_FREEIPMI_11X_12X */
+ {
+ if (fru_parse_ctx) {
+- (*nut_ipmi_fru_parse_close_device_id) (fru_parse_ctx);
+- (*nut_ipmi_fru_parse_ctx_destroy) (fru_parse_ctx);
++ (*nut_ipmi_fru_close_device_id) (fru_parse_ctx);
++ (*nut_ipmi_fru_ctx_destroy) (fru_parse_ctx);
+ }
+
+ #ifdef HAVE_FREEIPMI_11X_12X
+@@ -226,8 +226,8 @@
+ int ret = -1;
+ unsigned int area_type = 0;
+ unsigned int area_length = 0;
+- uint8_t areabuf[IPMI_FRU_PARSE_AREA_SIZE_MAX+1];
+- ipmi_fru_parse_ctx_t fru_parse_ctx = NULL;
++ uint8_t areabuf[IPMI_FRU_AREA_SIZE_MAX+1];
++ ipmi_fru_ctx_t fru_parse_ctx = NULL;
+ #ifdef HAVE_FREEIPMI_11X_12X
+ ipmi_sdr_ctx_t sdr_ctx = NULL;
+ #else /* HAVE_FREEIPMI_11X_12X */
+@@ -236,14 +236,14 @@
+ #endif /* HAVE_FREEIPMI_11X_12X */
+
+ /* Parse FRU information */
+- if (!(fru_parse_ctx = (*nut_ipmi_fru_parse_ctx_create) (ipmi_ctx)))
++ if (!(fru_parse_ctx = (*nut_ipmi_fru_ctx_create) (ipmi_ctx)))
+ {
+- fprintf(stderr, "ipmi_fru_parse_ctx_create()\n");
++ fprintf(stderr, "ipmi_fru_ctx_create()\n");
+ return 0;
+ }
+
+ /* lots of motherboards calculate checksums incorrectly */
+- if ((*nut_ipmi_fru_parse_ctx_set_flags) (fru_parse_ctx, IPMI_FRU_PARSE_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
++ if ((*nut_ipmi_fru_ctx_set_flags) (fru_parse_ctx, IPMI_FRU_FLAGS_SKIP_CHECKSUM_CHECKS) < 0)
+ {
+ #ifdef HAVE_FREEIPMI_11X_12X
+ nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
+@@ -253,7 +253,7 @@
+ return 0;
+ }
+
+- if ((*nut_ipmi_fru_parse_open_device_id) (fru_parse_ctx, ipmi_id) < 0)
++ if ((*nut_ipmi_fru_open_device_id) (fru_parse_ctx, ipmi_id) < 0)
+ {
+ #ifdef HAVE_FREEIPMI_11X_12X
+ nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
+@@ -268,14 +268,14 @@
+ /* clear fields */
+ area_type = 0;
+ area_length = 0;
+- memset (areabuf, '\0', IPMI_FRU_PARSE_AREA_SIZE_MAX + 1);
++ memset (areabuf, '\0', IPMI_FRU_AREA_SIZE_MAX + 1);
+
+ /* parse FRU buffer */
+- if ((*nut_ipmi_fru_parse_read_data_area) (fru_parse_ctx,
++ if ((*nut_ipmi_fru_read_data_area) (fru_parse_ctx,
+ &area_type,
+ &area_length,
+ areabuf,
+- IPMI_FRU_PARSE_AREA_SIZE_MAX) < 0)
++ IPMI_FRU_AREA_SIZE_MAX) < 0)
+ {
+ #ifdef HAVE_FREEIPMI_11X_12X
+ nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx);
+@@ -287,7 +287,7 @@
+
+ if (area_length)
+ {
+- if (area_type == IPMI_FRU_PARSE_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION)
++ if (area_type == IPMI_FRU_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION)
+ {
+ /* Found a POWER_SUPPLY record */
+ #ifdef HAVE_FREEIPMI_11X_12X
+@@ -298,7 +298,7 @@
+ return 1;
+ }
+ }
+- } while ((ret = (*nut_ipmi_fru_parse_next) (fru_parse_ctx)) == 1);
++ } while ((ret = (*nut_ipmi_fru_next) (fru_parse_ctx)) == 1);
+
+ /* No need for further errors checking */
+ #ifdef HAVE_FREEIPMI_11X_12X
diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upsd b/sys-power/nut/files/nut-2.6.5-init.d-upsd
new file mode 100644
index 000000000000..c4debd306601
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upsd
@@ -0,0 +1,37 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_started_commands="reload"
+
+pidfile=/var/lib/nut/upsd.pid
+bin=/usr/sbin/upsd
+
+depend() {
+ use net
+ before upsmon
+ after upsdrv
+}
+
+start() {
+ ebegin "Starting upsd"
+ # clean up first
+ pkill -u root,nut -x ${bin}
+ sleep 1
+ rm -f ${pidfile}
+ # now start up
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upsd"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading upsd"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upslog b/sys-power/nut/files/nut-2.6.5-init.d-upslog
new file mode 100644
index 000000000000..01a9d47036c5
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upslog
@@ -0,0 +1,30 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_started_commands="reload"
+
+pidfile=/var/run/upslog.pid
+bin=/usr/bin/upslog
+
+depend() {
+ use upsdrv
+ after upsdrv
+}
+
+start() {
+ ebegin "Starting upslog"
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upslog"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+reload() {
+ ebegin "Reloading upslog"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/sys-power/nut/files/nut-2.6.5-init.d-upsmon b/sys-power/nut/files/nut-2.6.5-init.d-upsmon
new file mode 100644
index 000000000000..3aafe1676d6e
--- /dev/null
+++ b/sys-power/nut/files/nut-2.6.5-init.d-upsmon
@@ -0,0 +1,29 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_started_commands="reload"
+
+pidfile=/var/run/upsmon.pid
+bin=/usr/sbin/upsmon
+
+depend() {
+ use net
+}
+
+start() {
+ ebegin "Starting upsmon"
+ start-stop-daemon --start --quiet --exec ${bin}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upsmon"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
+reload() {
+ ebegin "Reloading upsmon"
+ start-stop-daemon --stop --signal HUP --oknodo --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/sys-power/nut/files/nut-2.7.1-fix-scanning.patch b/sys-power/nut/files/nut-2.7.1-fix-scanning.patch
new file mode 100644
index 000000000000..6ef5e681ba96
--- /dev/null
+++ b/sys-power/nut/files/nut-2.7.1-fix-scanning.patch
@@ -0,0 +1,72 @@
+Search for correct libusb in testing.
+
+There may be many libusb libraries on a system, and we need to iterate until we
+find the correct one.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar --exclude .libs --exclude '*.o' --exclude core nut-2.7.1.orig/tools/nut-scanner/scan_usb.c nut-2.7.1/tools/nut-scanner/scan_usb.c
+--- nut-2.7.1.orig/tools/nut-scanner/scan_usb.c 2014-01-04 18:38:22.496816444 -0800
++++ nut-2.7.1/tools/nut-scanner/scan_usb.c 2014-01-04 19:05:04.598647935 -0800
+@@ -28,7 +28,7 @@
+ #include <ltdl.h>
+
+ /* dynamic link library stuff */
+-static char * libname = "libusb";
++static char * libname = "libusb-0.1";
+ static lt_dlhandle dl_handle = NULL;
+ static const char *dl_error = NULL;
+ static int (*nut_usb_close)(usb_dev_handle *dev);
+@@ -41,6 +41,8 @@
+ static usb_dev_handle * (*nut_usb_open)(struct usb_device *dev);
+ static int (*nut_usb_find_devices)(void);
+
++int nutscan_test_usb_library(const char*,void*);
++
+ /* return 0 on error */
+ int nutscan_load_usb_library()
+ {
+@@ -58,6 +60,22 @@
+ return 0;
+ }
+
++ int ret = lt_dlforeachfile(NULL, nutscan_test_usb_library, libname);
++ if(ret == 0) {
++ dl_handle = (void *)1;
++ lt_dlexit();
++ }
++
++ return ret;
++}
++
++int nutscan_test_usb_library(const char *filename, void* data) {
++ char prefix[64];
++ char *libname = (char*) data;
++ sprintf(prefix, "/%s", libname);
++ if(strstr(filename, prefix) == NULL)
++ return 0;
++
+- dl_handle = lt_dlopenext(libname);
++ dl_handle = lt_dlopenext(filename);
+ if (!dl_handle) {
+ dl_error = lt_dlerror();
+ goto err;
+@@ -100,16 +118,15 @@
+ goto err;
+ }
+
+ *(void **)(&nut_usb_find_devices) = lt_dlsym(dl_handle,"usb_find_devices");
+ if ((dl_error = lt_dlerror()) != NULL) {
+ goto err;
+ }
+
++ fprintf(stderr, "Loaded USB library (%s from %s) : USB search enabled.\n", libname, filename);
+ return 1;
+ err:
+- fprintf(stderr, "Cannot load USB library (%s) : %s. USB search disabled.\n", libname, dl_error);
+- dl_handle = (void *)1;
+- lt_dlexit();
++ fprintf(stderr, "Cannot load USB library (%s from %s) : %s. USB search disabled.\n", libname, filename, dl_error);
+ return 0;
+ }
+ /* end of dynamic link library stuff */
diff --git a/sys-power/nut/files/nut-2.7.1-snmpusb-order.patch b/sys-power/nut/files/nut-2.7.1-snmpusb-order.patch
new file mode 100644
index 000000000000..e62b6571d2ce
--- /dev/null
+++ b/sys-power/nut/files/nut-2.7.1-snmpusb-order.patch
@@ -0,0 +1,37 @@
+The code that generates the SNMP and USB headers to compile against does not
+have a deterministic order, leading to different results at times.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar --exclude .libs --exclude '*.o' --exclude core nut-2.7.1.orig/tools/nut-snmpinfo.py nut-2.7.1/tools/nut-snmpinfo.py
+--- nut-2.7.1.orig/tools/nut-snmpinfo.py 2014-01-04 19:08:19.117150636 -0800
++++ nut-2.7.1/tools/nut-snmpinfo.py 2013-07-26 12:41:11.000000000 -0700
+@@ -78,7 +78,9 @@
+ output_file.write( "/* SNMP IDs device table */\n" )
+ output_file.write( "static snmp_device_id_t snmp_device_table[] = {\n" )
+
+-for filename in glob.glob('../drivers/*-mib.c'):
++mibs = glob.glob('../drivers/*-mib.c')
++mibs.sort()
++for filename in mibs:
+ list_of_line = open(filename,'r').read().split(';')
+ for line in list_of_line:
+ if "mib2nut_info_t" in line:
+diff -Nuar --exclude .libs --exclude '*.o' --exclude core nut-2.7.1.orig/tools/nut-usbinfo.pl nut-2.7.1/tools/nut-usbinfo.pl
+--- nut-2.7.1.orig/tools/nut-usbinfo.pl 2014-01-04 19:12:45.595949760 -0800
++++ nut-2.7.1/tools/nut-usbinfo.pl 2013-11-17 11:27:38.000000000 -0800
+@@ -75,7 +75,12 @@
+
+ ################# MAIN #################
+
+-find(\&find_usbdevs,$scanPath);
++find({
++ wanted => \&find_usbdevs,
++ follow => 1,
++ preprocess => sub { return sort @_ },
++ },
++ $scanPath);
+ &gen_usb_files;
+
+ ################# SUB METHOD #################
+
diff --git a/sys-power/nut/files/nut-2.7.2/nut-2.7.2-no-libdummy.patch b/sys-power/nut/files/nut-2.7.2/nut-2.7.2-no-libdummy.patch
new file mode 100644
index 000000000000..ca0d8be028f5
--- /dev/null
+++ b/sys-power/nut/files/nut-2.7.2/nut-2.7.2-no-libdummy.patch
@@ -0,0 +1,13 @@
+diff --git a/drivers/Makefile.am b/drivers/Makefile.am
+index 99614ca..42b3611 100644
+--- a/drivers/Makefile.am
++++ b/drivers/Makefile.am
+@@ -267,5 +267,6 @@ dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h bcmxcp.h \
+
+ # Define a dummy library so that Automake builds rules for the
+ # corresponding object files. This library is not actually built,
+-EXTRA_LIBRARIES = libdummy.a
+-libdummy_a_SOURCES = main.c dstate.c serial.c
++EXTRA_LIBRARIES =
++#EXTRA_LIBRARIES = libdummy.a
++#libdummy_a_SOURCES = main.c dstate.c serial.c
diff --git a/sys-power/nut/files/nut.powerfail.initd b/sys-power/nut/files/nut.powerfail.initd
new file mode 100644
index 000000000000..fd26b4f76aec
--- /dev/null
+++ b/sys-power/nut/files/nut.powerfail.initd
@@ -0,0 +1,48 @@
+#!/sbin/openrc-run
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description='Signal the UPS to kill power in a power failure condition'
+
+depend() {
+ # This is only for baselayout2
+ if [ -f /etc/init.d/sysfs ]; then
+ keyword -jail -lxc -openvz -prefix -uml -vserver -xenu -timeout
+ need mount-ro
+ fi
+}
+
+start() {
+ if [ ! -f /etc/init.d/sysfs ]; then
+ eerror "The $SVCNAME init-script is written for baselayout-2!"
+ eerror "Please do not use it with baselayout-1!".
+ return 1
+ fi
+ local UPS_CTL UPS_POWERDOWN
+
+ if [ -f /etc/killpower -o -f /etc/nut/killpower ]; then
+ UPS_CTL=/sbin/upsdrvctl
+ UPS_POWERDOWN="${UPS_CTL} shutdown"
+ elif [ -f /etc/apcupsd/powerfail ]; then
+ UPS_CTL=/sbin/apcupsd
+ UPS_POWERDOWN="${UPS_CTL} --killpower"
+ else
+ ewarn "UPS powerfail script scheduled, but no poweroff commands found."
+ return 0
+ fi
+
+ if [ -f "${UPS_CTL}" -a -x "${UPS_CTL}" ]; then
+ ebegin 'Signaling UPS to kill power'
+ ${UPS_POWERDOWN}
+ eend $?
+
+ ebegin 'Halt system and wait for the UPS to kill our power'
+ /sbin/halt -id
+ # If the sleep gets hit, something is wrong...
+ # do NOT restart the system.
+ while [ 1 ]; do sleep 60; done
+ else
+ ewarn "UPS powerfail script scheduled, and flags found, but ${UPS_CTL} missing."
+ fi
+}
+
diff --git a/sys-power/nut/metadata.xml b/sys-power/nut/metadata.xml
new file mode 100644
index 000000000000..bfe6c7469998
--- /dev/null
+++ b/sys-power/nut/metadata.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>robbat2@gentoo.org</email>
+ <name>Robin H. Johnson</name>
+ </maintainer>
+ <maintainer type="person">
+ <email>prometheanfire@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name="ipmi">Support IPMI-based UPSes.</flag>
+ <flag name="ups_drivers_al175">Driver for Eltek UPS models with AL175 alarm module</flag>
+ <flag name="ups_drivers_bcmxcp">Driver for UPSes supporting the serial BCM/XCP protocol</flag>
+ <flag name="ups_drivers_belkin">Driver for Belkin serial UPS equipment</flag>
+ <flag name="ups_drivers_belkinunv">Driver for Belkin "Universal UPS" and compatible</flag>
+ <flag name="ups_drivers_bestfcom">Driver for Best Power Fortress/Ferrups</flag>
+ <flag name="ups_drivers_bestfortress">Driver for old Best Fortress UPS equipment</flag>
+ <flag name="ups_drivers_bestuferrups">Driver for Best Power Micro-Ferrups</flag>
+ <flag name="ups_drivers_bestups">Driver for Best Power / SOLA (Phoenixtec protocol) UPS equipment</flag>
+ <flag name="ups_drivers_dummy-ups">Driver for multi-purpose UPS emulation</flag>
+ <flag name="ups_drivers_etapro">Driver for ETA UPS equipment</flag>
+ <flag name="ups_drivers_everups">Driver for Ever UPS models</flag>
+ <flag name="ups_drivers_gamatronic">Driver for Gamatronic UPS equipment</flag>
+ <flag name="ups_drivers_genericups">Driver for contact-closure UPS equipment</flag>
+ <flag name="ups_drivers_isbmex">Driver for ISBMEX UPS equipment</flag>
+ <flag name="ups_drivers_liebert">Driver for Liebert contact-closure UPS equipment</flag>
+ <flag name="ups_drivers_liebert-esp2">Driver for Liebert UPS, using the ESP-II serial protocol</flag>
+ <flag name="ups_drivers_masterguard">Driver for Masterguard UPS equipment</flag>
+ <flag name="ups_drivers_metasys">Driver for Meta System UPS equipment</flag>
+ <flag name="ups_drivers_mge-utalk">Driver for MGE UPS SYSTEMS UTalk protocol equipment</flag>
+ <flag name="ups_drivers_microdowell">Driver for Microdowell Enterprise UPS series</flag>
+ <flag name="ups_drivers_mge-shut">Driver for SHUT Protocol UPS equipment</flag>
+ <flag name="ups_drivers_oldmge-shut">Driver for SHUT Protocol UPS equipment (older implementation)</flag>
+ <flag name="ups_drivers_oneac">Driver for Oneac UPS equipment</flag>
+ <flag name="ups_drivers_optiups">Driver for Opti-UPS (Viewsonic) UPS and Zinto D (ONLINE-USV) equipment</flag>
+ <flag name="ups_drivers_powercom">UPS driver for serial Powercom/Trust/Advice UPS equipment</flag>
+ <flag name="ups_drivers_rhino">Driver for Brazilian Microsol RHINO UPS equipment</flag>
+ <flag name="ups_drivers_safenet">Driver for SafeNet compatible UPS equipment</flag>
+ <flag name="ups_drivers_solis">Driver for Brazilian Microsol SOLIS UPS equipment</flag>
+ <flag name="ups_drivers_tripplite">Driver for Tripp-Lite SmartPro UPS equipment</flag>
+ <flag name="ups_drivers_tripplitesu">Driver for Tripp-Lite SmartOnline (SU) UPS equipment</flag>
+ <flag name="ups_drivers_upscode2">Driver for UPScode II compatible UPS equipment</flag>
+ <flag name="ups_drivers_victronups">Driver for IMV/Victron UPS unit Match, Match Lite, NetUps</flag>
+ <flag name="ups_drivers_powerpanel">Driver for PowerPanel Plus compatible UPS equipment</flag>
+ <flag name="ups_drivers_blazer_ser">Driver for Megatec/Q1 protocol serial based UPS equipment</flag>
+ <flag name="ups_drivers_clone">Fake driver to clone outlets for device grouping</flag>
+ <flag name="ups_drivers_clone-outlet">Fake driver to clone outlets for device grouping</flag>
+ <flag name="ups_drivers_ivtscd">driver for the IVT Solar Controller Device</flag>
+ <flag name="ups_drivers_apcsmart">Driver for American Power Conversion Smart Protocol UPS equipment</flag>
+ <flag name="ups_drivers_apcsmart-old">Driver for American Power Conversion Smart Protocol UPS equipment</flag>
+ <flag name="ups_drivers_apcupsd-ups">Driver for apcupsd client access</flag>
+ <flag name="ups_drivers_riello_ser">Driver for Riello UPS Protocol UPS equipment</flag>
+ <flag name="ups_drivers_nutdrv_qx">Driver for Q* protocol serial and USB based UPS equipment</flag>
+ <flag name="ups_drivers_usbhid-ups">Driver for USB/HID UPS equipment</flag>
+ <flag name="ups_drivers_bcmxcp_usb">Experimental driver for UPSes supporting the BCM/XCP protocol over USB</flag>
+ <flag name="ups_drivers_tripplite_usb">Driver for older Tripp Lite USB UPSes (not PDC HID)</flag>
+ <flag name="ups_drivers_blazer_usb">Driver for Megatec/Q1 protocol USB based UPS equipment</flag>
+ <flag name="ups_drivers_richcomm_usb">Driver UPS equipment using Richcomm dry-contact to USB solution</flag>
+ <flag name="ups_drivers_riello_usb">Driver for Riello UPS Protocol UPS equipment via USB</flag>
+ <flag name="ups_drivers_netxml-ups">Driver for Eaton / MGE Network Management Card / Proxy (XML/HTTP Protocol) equipment</flag>
+ <flag name="ups_drivers_snmp-ups">Multi-MIB Driver for SNMP UPS equipment</flag>
+ <flag name="ups_drivers_nut-ipmipsu">Driver for IPMI Power Supply Units (PSU)</flag>
+ </use>
+</pkgmetadata>
diff --git a/sys-power/nut/nut-2.6.5-r1.ebuild b/sys-power/nut/nut-2.6.5-r1.ebuild
new file mode 100644
index 000000000000..02735da8d6b6
--- /dev/null
+++ b/sys-power/nut/nut-2.6.5-r1.ebuild
@@ -0,0 +1,231 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit autotools bash-completion-r1 eutils fixheadtails multilib user systemd
+
+MY_P=${P/_/-}
+
+DESCRIPTION="Network-UPS Tools"
+HOMEPAGE="http://www.networkupstools.org/"
+# Nut mirrors are presently broken
+SRC_URI="http://random.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz
+ http://www.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm ppc ppc64 x86 ~x86-fbsd"
+IUSE="avahi cgi ipmi snmp usb selinux ssl tcpd xml"
+
+CDEPEND="avahi? ( net-dns/avahi )
+ cgi? ( >=media-libs/gd-2[png] )
+ snmp? ( net-analyzer/net-snmp )
+ usb? ( virtual/libusb:0 )
+ ssl? ( >=dev-libs/openssl-1 )
+ tcpd? ( sys-apps/tcp-wrappers )
+ xml? ( >=net-libs/neon-0.25.0 )
+ ipmi? ( sys-libs/freeipmi )
+ virtual/udev"
+DEPEND="$CDEPEND
+ >=sys-apps/sed-4
+ virtual/pkgconfig"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-nut )
+"
+
+S=${WORKDIR}/${MY_P}
+
+# public files should be 644 root:root
+NUT_PUBLIC_FILES="/etc/nut/{ups,upssched}.conf"
+# private files should be 640 root:nut - readable by nut, writeable by root,
+NUT_PRIVATE_FILES="/etc/nut/{upsd.conf,upsd.users,upsmon.conf}"
+# public files should be 644 root:root, only installed if USE=cgi
+NUT_CGI_FILES="/etc/nut/{{hosts,upsset}.conf,upsstats{,-single}.html}"
+
+pkg_setup() {
+ enewgroup nut 84
+ enewuser nut 84 -1 /var/lib/nut nut,uucp
+ # As of udev-104, NUT must be in uucp and NOT in tty.
+ gpasswd -d nut tty 2>/dev/null
+ gpasswd -a nut uucp 2>/dev/null
+ # in some cases on old systems it wasn't in the nut group either!
+ gpasswd -a nut nut 2>/dev/null
+ warningmsg ewarn
+}
+
+src_prepare() {
+ ht_fix_file configure.in
+
+ epatch "${FILESDIR}"/${PN}-2.4.1-no-libdummy.patch
+ epatch "${FILESDIR}"/${PN}-2.6.2-lowspeed-buffer-size.patch
+ #epatch "${FILESDIR}"/${PN}-2.6.3-CVE-2012-2944.patch
+ epatch "${FILESDIR}"/${PN}-2.6.5-freeipmi_fru.patch
+
+ sed -e "s:GD_LIBS.*=.*-L/usr/X11R6/lib \(.*\) -lXpm -lX11:GD_LIBS=\"\1:" \
+ -e '/systemdsystemunitdir=.*echo.*sed.*libdir/s,^,#,g' \
+ -i configure.in || die
+
+ sed -e "s:52.nut-usbups.rules:70-nut-usbups.rules:" \
+ -i scripts/udev/Makefile.am || die
+
+ rm -f ltmain.sh m4/lt* m4/libtool.m4
+
+ sed -i \
+ -e 's:@LIBSSL_LDFLAGS@:@LIBSSL_LIBS@:' \
+ lib/libupsclient{.pc,-config}.in || die #361685
+
+ eautoreconf
+}
+
+src_configure() {
+ local myconf
+
+ if [ -n "${NUT_DRIVERS}" ]; then
+ myconf="${myconf} --with-drivers=${NUT_DRIVERS// /,}"
+ fi
+
+ use cgi && myconf="${myconf} --with-cgipath=/usr/share/nut/cgi"
+
+ # TODO: USE flag for sys-power/powerman
+ econf \
+ --sysconfdir=/etc/nut \
+ --datarootdir=/usr/share/nut \
+ --datadir=/usr/share/nut \
+ --disable-static \
+ --with-statepath=/var/lib/nut \
+ --with-drvpath=/$(get_libdir)/nut \
+ --with-htmlpath=/usr/share/nut/html \
+ --with-user=nut \
+ --with-group=nut \
+ --with-logfacility=LOG_DAEMON \
+ --with-dev \
+ --with-serial \
+ --without-hal \
+ --without-powerman \
+ $(use_with avahi) \
+ $(use_with cgi) \
+ $(use_with ipmi) \
+ $(use_with ipmi freeipmi) \
+ $(use_with snmp) \
+ $(use_with ssl) \
+ $(use_with tcpd wrap) \
+ $(use_with usb) \
+ $(use_with xml neon) \
+ $(systemd_with_unitdir) \
+ ${myconf}
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ find "${D}" -name '*.la' -exec rm -f {} +
+
+ dodir /sbin
+ dosym /$(get_libdir)/nut/upsdrvctl /sbin/upsdrvctl
+ # This needs to exist for the scripts
+ dosym /$(get_libdir)/nut/upsdrvctl /usr/sbin/upsdrvctl
+
+ if use cgi; then
+ elog "CGI monitoring scripts are installed in /usr/share/nut/cgi."
+ elog "copy them to your web server's ScriptPath to activate (this is a"
+ elog "change from the old location)."
+ elog "If you use lighttpd, see lighttpd_nut.conf in the documentation."
+ fi
+
+ # this must be done after all of the install phases
+ for i in "${D}"/etc/nut/*.sample ; do
+ mv "${i}" "${i/.sample/}"
+ done
+
+ dodoc AUTHORS ChangeLog docs/*.txt MAINTAINERS NEWS README TODO UPGRADING || die
+
+ newdoc lib/README README.lib || die
+ newdoc "${FILESDIR}"/lighttpd_nut.conf-2.2.0 lighttpd_nut.conf || die
+
+ docinto cables
+ dodoc docs/cables/* || die
+
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsd upsd || die
+ newinitd "${FILESDIR}"/nut-2.2.2-init.d-upsdrv upsdrv || die
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsmon upsmon || die
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upslog upslog || die
+ newinitd "${FILESDIR}"/nut.powerfail.initd nut.powerfail || die
+
+ keepdir /var/lib/nut
+
+ einfo "Setting up permissions on files and directories"
+ fperms 0700 /var/lib/nut
+ fowners nut:nut /var/lib/nut
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval fperms 0640 ${NUT_PRIVATE_FILES}
+ eval fowners root:nut ${NUT_PRIVATE_FILES}
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval fperms 0644 ${NUT_PUBLIC_FILES}
+ eval fowners root:root ${NUT_PUBLIC_FILES}
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ if use cgi; then
+ eval fperms 0644 ${NUT_CGI_FILES}
+ eval fowners root:root ${NUT_CGI_FILES}
+ fi
+
+ # this is installed for 2.4 and fbsd guys
+ if ! has_version virtual/udev; then
+ einfo "Installing non-udev hotplug support"
+ insinto /etc/hotplug/usb
+ insopts -m 755
+ doins scripts/hotplug/nut-usbups.hotplug
+ fi
+
+ dobashcomp "${S}"/scripts/misc/nut.bash_completion
+}
+
+pkg_postinst() {
+ # this is to ensure that everybody that installed old versions still has
+ # correct permissions
+
+ chown nut:nut "${ROOT}"/var/lib/nut 2>/dev/null
+ chmod 0700 "${ROOT}"/var/lib/nut 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval chown root:nut "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
+ eval chmod 0640 "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval chown root:root "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
+ eval chmod 0644 "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ if use cgi; then
+ eval chown root:root "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
+ eval chmod 0644 "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
+ fi
+
+ warningmsg elog
+}
+
+warningmsg() {
+ msgfunc="$1"
+ [ -z "$msgfunc" ] && die "msgfunc not specified in call to warningmsg!"
+ ${msgfunc} "Please note that NUT now runs under the 'nut' user."
+ ${msgfunc} "NUT is in the uucp group for access to RS-232 UPS."
+ ${msgfunc} "However if you use a USB UPS you may need to look at the udev or"
+ ${msgfunc} "hotplug rules that are installed, and alter them suitably."
+ ${msgfunc} ''
+ ${msgfunc} "You are strongly advised to read the UPGRADING file provided by upstream."
+ ${msgfunc} ''
+ ${msgfunc} "Please note that upsdrv is NOT automatically started by upsd anymore."
+ ${msgfunc} "If you have multiple UPS units, you can use their NUT names to"
+ ${msgfunc} "have a service per UPS:"
+ ${msgfunc} "ln -s /etc/init.d/upsdrv /etc/init.d/upsdrv.\$UPSNAME"
+ ${msgfunc} ''
+ ${msgfunc} 'If you want apcupsd to power off your UPS when it'
+ ${msgfunc} 'shuts down your system in a power failure, you must'
+ ${msgfunc} 'add nut.powerfail to your shutdown runlevel:'
+ ${msgfunc} ''
+ ${msgfunc} 'rc-update add nut.powerfail shutdown'
+ ${msgfunc} ''
+
+}
diff --git a/sys-power/nut/nut-2.7.2-r2.ebuild b/sys-power/nut/nut-2.7.2-r2.ebuild
new file mode 100644
index 000000000000..8f9e94b92e46
--- /dev/null
+++ b/sys-power/nut/nut-2.7.2-r2.ebuild
@@ -0,0 +1,274 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit autotools bash-completion-r1 eutils fixheadtails multilib user systemd flag-o-matic toolchain-funcs
+
+MY_P=${P/_/-}
+
+DESCRIPTION="Network-UPS Tools"
+HOMEPAGE="http://www.networkupstools.org/"
+# Nut mirrors are presently broken
+SRC_URI="http://random.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz
+ http://www.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~x86-fbsd"
+
+IUSE="avahi cgi ipmi snmp +usb selinux ssl tcpd xml"
+CDEPEND="avahi? ( net-dns/avahi )
+ cgi? ( >=media-libs/gd-2[png] )
+ snmp? ( net-analyzer/net-snmp )
+ usb? ( virtual/libusb:0 )
+ ssl? ( >=dev-libs/openssl-1 )
+ tcpd? ( sys-apps/tcp-wrappers )
+ xml? ( >=net-libs/neon-0.25.0 )
+ ipmi? ( sys-libs/freeipmi )
+ virtual/udev"
+DEPEND="$CDEPEND
+ >=sys-apps/sed-4
+ virtual/pkgconfig"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-nut )
+"
+
+S=${WORKDIR}/${MY_P}
+
+# Bug #480664 requested UPS_DRIVERS_IUSE for more flexibility in building this package
+SERIAL_DRIVERLIST="al175 bcmxcp belkin belkinunv bestfcom bestfortress bestuferrups bestups dummy-ups etapro everups gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino safenet solis tripplite tripplitesu upscode2 victronups powerpanel blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old apcupsd-ups riello_ser nutdrv_qx"
+SNMP_DRIVERLIST="snmp-ups"
+USB_LIBUSB_DRIVERLIST="usbhid-ups bcmxcp_usb tripplite_usb blazer_usb richcomm_usb riello_usb nutdrv_qx"
+USB_DRIVERLIST=${USB_LIBUSB_DRIVERLIST}
+#HAL_DRIVERLIST="usbhid-ups bcmxcp_usb tripplite_usb blazer_usb riello_usb nutdrv_qx"
+NEONXML_DRIVERLIST="netxml-ups"
+IPMI_DRIVERLIST="nut-ipmipsu"
+# Now we build from it:
+for name in ${SERIAL_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} +ups_drivers_${name}"
+done
+for name in ${USB_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} +ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( usb )"
+done
+for name in ${NEONXML_DRIVERLIST}; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( xml )"
+done
+for name in ${SNMP_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( snmp )"
+done
+for name in ${IPMI_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( ipmi )"
+done
+IUSE="${IUSE} ${IUSE_UPS_DRIVERS}"
+
+# public files should be 644 root:root
+NUT_PUBLIC_FILES="/etc/nut/{ups,upssched}.conf"
+# private files should be 640 root:nut - readable by nut, writeable by root,
+NUT_PRIVATE_FILES="/etc/nut/{upsd.conf,upsd.users,upsmon.conf}"
+# public files should be 644 root:root, only installed if USE=cgi
+NUT_CGI_FILES="/etc/nut/{{hosts,upsset}.conf,upsstats{,-single}.html}"
+
+pkg_setup() {
+ enewgroup nut 84
+ enewuser nut 84 -1 /var/lib/nut nut,uucp
+ # As of udev-104, NUT must be in uucp and NOT in tty.
+ gpasswd -d nut tty 2>/dev/null
+ gpasswd -a nut uucp 2>/dev/null
+ # in some cases on old systems it wasn't in the nut group either!
+ gpasswd -a nut nut 2>/dev/null
+ warningmsg ewarn
+}
+
+src_prepare() {
+ #ht_fix_file configure.in
+
+ epatch "${FILESDIR}/nut-2.7.2/nut-2.7.2-no-libdummy.patch"
+ epatch "${FILESDIR}"/${PN}-2.6.2-lowspeed-buffer-size.patch
+ #epatch "${FILESDIR}"/${PN}-2.6.3-CVE-2012-2944.patch
+ #epatch "${FILESDIR}"/${PN}-2.6.5-freeipmi_fru.patch
+ epatch "${FILESDIR}"/${PN}-2.7.1-fix-scanning.patch
+ epatch "${FILESDIR}"/${PN}-2.7.1-snmpusb-order.patch
+
+ sed -e "s:GD_LIBS.*=.*-L/usr/X11R6/lib \(.*\) -lXpm -lX11:GD_LIBS=\"\1:" \
+ -e '/systemdsystemunitdir=.*echo.*sed.*libdir/s,^,#,g' \
+ -i configure.ac || die
+
+ sed -e "s:52.nut-usbups.rules:70-nut-usbups.rules:" \
+ -i scripts/udev/Makefile.am || die
+
+ rm -f ltmain.sh m4/lt* m4/libtool.m4
+
+ sed -i \
+ -e 's:@LIBSSL_LDFLAGS@:@LIBSSL_LIBS@:' \
+ lib/libupsclient{.pc,-config}.in || die #361685
+
+ # This file appears twice in the install list, and if both install rules
+ # trigger simultaneously during parallel-make, it fails.
+ sed -i \
+ -e '/nodist_sysconf_DATA/s,upsmon.conf.sample,,g' \
+ conf/Makefile.am || die
+
+ eautoreconf
+}
+
+src_configure() {
+ local myconf
+ append-flags -fno-lto
+ tc-export CC
+ tc-export CXX
+ tc-export AR
+
+ local UPS_DRIVERS=""
+ for u in $USE ; do
+ u2=${u#ups_drivers_}
+ [[ "${u}" != "${u2}" ]] && UPS_DRIVERS="${UPS_DRIVERS} ${u2}"
+ done
+ UPS_DRIVERS="${UPS_DRIVERS# }" UPS_DRIVERS="${UPS_DRIVERS% }"
+ myconf="${myconf} --with-drivers=${UPS_DRIVERS// /,}"
+
+ use cgi && myconf="${myconf} --with-cgipath=/usr/share/nut/cgi"
+
+ # TODO: USE flag for sys-power/powerman
+ econf \
+ --sysconfdir=/etc/nut \
+ --datarootdir=/usr/share/nut \
+ --datadir=/usr/share/nut \
+ --disable-static \
+ --with-statepath=/var/lib/nut \
+ --with-drvpath=/$(get_libdir)/nut \
+ --with-htmlpath=/usr/share/nut/html \
+ --with-user=nut \
+ --with-group=nut \
+ --with-logfacility=LOG_DAEMON \
+ --with-dev \
+ --with-serial \
+ --without-powerman \
+ $(use_with avahi) \
+ $(use_with cgi) \
+ $(use_with ipmi) \
+ $(use_with ipmi freeipmi) \
+ $(use_with snmp) \
+ $(use_with ssl) \
+ $(use_with tcpd wrap) \
+ $(use_with usb) \
+ $(use_with xml neon) \
+ $(systemd_with_unitdir) \
+ ${myconf}
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ find "${D}" -name '*.la' -exec rm -f {} +
+
+ dodir /sbin
+ dosym /usr/sbin/upsdrvctl /sbin/upsdrvctl
+
+ if use cgi; then
+ elog "CGI monitoring scripts are installed in /usr/share/nut/cgi."
+ elog "copy them to your web server's ScriptPath to activate (this is a"
+ elog "change from the old location)."
+ elog "If you use lighttpd, see lighttpd_nut.conf in the documentation."
+ fi
+
+ # this must be done after all of the install phases
+ for i in "${D}"/etc/nut/*.sample ; do
+ mv "${i}" "${i/.sample/}"
+ done
+
+ dodoc AUTHORS ChangeLog docs/*.txt MAINTAINERS NEWS README TODO UPGRADING || die
+
+ newdoc lib/README README.lib || die
+ newdoc "${FILESDIR}"/lighttpd_nut.conf-2.2.0 lighttpd_nut.conf || die
+
+ docinto cables
+ dodoc docs/cables/* || die
+
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsd upsd || die
+ newinitd "${FILESDIR}"/nut-2.2.2-init.d-upsdrv upsdrv || die
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsmon upsmon || die
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upslog upslog || die
+ newinitd "${FILESDIR}"/nut.powerfail.initd nut.powerfail || die
+
+ keepdir /var/lib/nut
+
+ einfo "Setting up permissions on files and directories"
+ fperms 0700 /var/lib/nut
+ fowners nut:nut /var/lib/nut
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval fperms 0640 ${NUT_PRIVATE_FILES}
+ eval fowners root:nut ${NUT_PRIVATE_FILES}
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval fperms 0644 ${NUT_PUBLIC_FILES}
+ eval fowners root:root ${NUT_PUBLIC_FILES}
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ if use cgi; then
+ eval fperms 0644 ${NUT_CGI_FILES}
+ eval fowners root:root ${NUT_CGI_FILES}
+ fi
+
+ # this is installed for 2.4 and fbsd guys
+ if ! has_version virtual/udev; then
+ einfo "Installing non-udev hotplug support"
+ insinto /etc/hotplug/usb
+ insopts -m 755
+ doins scripts/hotplug/nut-usbups.hotplug
+ fi
+
+ dobashcomp "${S}"/scripts/misc/nut.bash_completion
+}
+
+pkg_postinst() {
+ # this is to ensure that everybody that installed old versions still has
+ # correct permissions
+
+ chown nut:nut "${ROOT}"/var/lib/nut 2>/dev/null
+ chmod 0700 "${ROOT}"/var/lib/nut 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval chown root:nut "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
+ eval chmod 0640 "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval chown root:root "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
+ eval chmod 0644 "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ if use cgi; then
+ eval chown root:root "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
+ eval chmod 0644 "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
+ fi
+
+ warningmsg elog
+}
+
+warningmsg() {
+ msgfunc="$1"
+ [ -z "$msgfunc" ] && die "msgfunc not specified in call to warningmsg!"
+ ${msgfunc} "Please note that NUT now runs under the 'nut' user."
+ ${msgfunc} "NUT is in the uucp group for access to RS-232 UPS."
+ ${msgfunc} "However if you use a USB UPS you may need to look at the udev or"
+ ${msgfunc} "hotplug rules that are installed, and alter them suitably."
+ ${msgfunc} ''
+ ${msgfunc} "You are strongly advised to read the UPGRADING file provided by upstream."
+ ${msgfunc} ''
+ ${msgfunc} "Please note that upsdrv is NOT automatically started by upsd anymore."
+ ${msgfunc} "If you have multiple UPS units, you can use their NUT names to"
+ ${msgfunc} "have a service per UPS:"
+ ${msgfunc} "ln -s /etc/init.d/upsdrv /etc/init.d/upsdrv.\$UPSNAME"
+ ${msgfunc} ''
+ ${msgfunc} 'If you want apcupsd to power off your UPS when it'
+ ${msgfunc} 'shuts down your system in a power failure, you must'
+ ${msgfunc} 'add nut.powerfail to your shutdown runlevel:'
+ ${msgfunc} ''
+ ${msgfunc} 'rc-update add nut.powerfail shutdown'
+ ${msgfunc} ''
+
+}
diff --git a/sys-power/nut/nut-2.7.3.ebuild b/sys-power/nut/nut-2.7.3.ebuild
new file mode 100644
index 000000000000..55dd831f344f
--- /dev/null
+++ b/sys-power/nut/nut-2.7.3.ebuild
@@ -0,0 +1,269 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit autotools bash-completion-r1 eutils fixheadtails multilib user systemd flag-o-matic toolchain-funcs
+
+MY_P=${P/_/-}
+
+DESCRIPTION="Network-UPS Tools"
+HOMEPAGE="http://www.networkupstools.org/"
+# Nut mirrors are presently broken
+SRC_URI="http://random.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz
+ http://www.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 arm ppc ppc64 x86 ~x86-fbsd"
+
+IUSE="cgi ipmi snmp +usb selinux ssl tcpd xml zeroconf"
+CDEPEND="
+ cgi? ( >=media-libs/gd-2[png] )
+ snmp? ( net-analyzer/net-snmp )
+ usb? ( virtual/libusb:0 )
+ ssl? ( >=dev-libs/openssl-1 )
+ tcpd? ( sys-apps/tcp-wrappers )
+ xml? ( >=net-libs/neon-0.25.0 )
+ ipmi? ( sys-libs/freeipmi )
+ zeroconf? ( net-dns/avahi )
+ virtual/udev"
+DEPEND="$CDEPEND
+ >=sys-apps/sed-4
+ virtual/pkgconfig"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-nut )
+"
+
+S=${WORKDIR}/${MY_P}
+
+# Bug #480664 requested UPS_DRIVERS_IUSE for more flexibility in building this package
+SERIAL_DRIVERLIST="al175 bcmxcp belkin belkinunv bestfcom bestfortress bestuferrups bestups dummy-ups etapro everups gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino safenet solis tripplite tripplitesu upscode2 victronups powerpanel blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old apcupsd-ups riello_ser nutdrv_qx"
+SNMP_DRIVERLIST="snmp-ups"
+USB_LIBUSB_DRIVERLIST="usbhid-ups bcmxcp_usb tripplite_usb blazer_usb richcomm_usb riello_usb nutdrv_qx"
+USB_DRIVERLIST=${USB_LIBUSB_DRIVERLIST}
+#HAL_DRIVERLIST="usbhid-ups bcmxcp_usb tripplite_usb blazer_usb riello_usb nutdrv_qx"
+NEONXML_DRIVERLIST="netxml-ups"
+IPMI_DRIVERLIST="nut-ipmipsu"
+# Now we build from it:
+for name in ${SERIAL_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} +ups_drivers_${name}"
+done
+for name in ${USB_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} +ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( usb )"
+done
+for name in ${NEONXML_DRIVERLIST}; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( xml )"
+done
+for name in ${SNMP_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( snmp )"
+done
+for name in ${IPMI_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( ipmi )"
+done
+IUSE="${IUSE} ${IUSE_UPS_DRIVERS}"
+
+# public files should be 644 root:root
+NUT_PUBLIC_FILES="/etc/nut/{ups,upssched}.conf"
+# private files should be 640 root:nut - readable by nut, writeable by root,
+NUT_PRIVATE_FILES="/etc/nut/{upsd.conf,upsd.users,upsmon.conf}"
+# public files should be 644 root:root, only installed if USE=cgi
+NUT_CGI_FILES="/etc/nut/{{hosts,upsset}.conf,upsstats{,-single}.html}"
+
+pkg_setup() {
+ enewgroup nut 84
+ enewuser nut 84 -1 /var/lib/nut nut,uucp
+ # As of udev-104, NUT must be in uucp and NOT in tty.
+ gpasswd -d nut tty 2>/dev/null
+ gpasswd -a nut uucp 2>/dev/null
+ # in some cases on old systems it wasn't in the nut group either!
+ gpasswd -a nut nut 2>/dev/null
+ warningmsg ewarn
+}
+
+src_prepare() {
+ #ht_fix_file configure.in
+
+ epatch "${FILESDIR}/nut-2.7.2/nut-2.7.2-no-libdummy.patch"
+ epatch "${FILESDIR}"/${PN}-2.6.2-lowspeed-buffer-size.patch
+ #epatch "${FILESDIR}"/${PN}-2.6.3-CVE-2012-2944.patch
+ #epatch "${FILESDIR}"/${PN}-2.6.5-freeipmi_fru.patch
+ epatch "${FILESDIR}"/${PN}-2.7.1-fix-scanning.patch
+ epatch "${FILESDIR}"/${PN}-2.7.1-snmpusb-order.patch
+
+ sed -e "s:GD_LIBS.*=.*-L/usr/X11R6/lib \(.*\) -lXpm -lX11:GD_LIBS=\"\1:" \
+ -e '/systemdsystemunitdir=.*echo.*sed.*libdir/s,^,#,g' \
+ -i configure.ac || die
+
+ sed -e "s:52.nut-usbups.rules:70-nut-usbups.rules:" \
+ -i scripts/udev/Makefile.am || die
+
+ rm -f ltmain.sh m4/lt* m4/libtool.m4
+
+ sed -i \
+ -e 's:@LIBSSL_LDFLAGS@:@LIBSSL_LIBS@:' \
+ lib/libupsclient{.pc,-config}.in || die #361685
+
+ eautoreconf
+}
+
+src_configure() {
+ local myconf
+ append-flags -fno-lto
+ tc-export CC
+ tc-export CXX
+ tc-export AR
+
+ local UPS_DRIVERS=""
+ for u in $USE ; do
+ u2=${u#ups_drivers_}
+ [[ "${u}" != "${u2}" ]] && UPS_DRIVERS="${UPS_DRIVERS} ${u2}"
+ done
+ UPS_DRIVERS="${UPS_DRIVERS# }" UPS_DRIVERS="${UPS_DRIVERS% }"
+ myconf="${myconf} --with-drivers=${UPS_DRIVERS// /,}"
+
+ use cgi && myconf="${myconf} --with-cgipath=/usr/share/nut/cgi"
+
+ # TODO: USE flag for sys-power/powerman
+ econf \
+ --sysconfdir=/etc/nut \
+ --datarootdir=/usr/share/nut \
+ --datadir=/usr/share/nut \
+ --disable-static \
+ --with-statepath=/var/lib/nut \
+ --with-drvpath=/$(get_libdir)/nut \
+ --with-htmlpath=/usr/share/nut/html \
+ --with-user=nut \
+ --with-group=nut \
+ --with-logfacility=LOG_DAEMON \
+ --with-dev \
+ --with-serial \
+ --without-powerman \
+ $(use_with cgi) \
+ $(use_with ipmi) \
+ $(use_with ipmi freeipmi) \
+ $(use_with snmp) \
+ $(use_with ssl) \
+ $(use_with tcpd wrap) \
+ $(use_with usb) \
+ $(use_with xml neon) \
+ $(use_with zeroconf avahi) \
+ $(systemd_with_unitdir) \
+ ${myconf}
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ find "${D}" -name '*.la' -exec rm -f {} +
+
+ dodir /sbin
+ dosym /usr/sbin/upsdrvctl /sbin/upsdrvctl
+
+ if use cgi; then
+ elog "CGI monitoring scripts are installed in /usr/share/nut/cgi."
+ elog "copy them to your web server's ScriptPath to activate (this is a"
+ elog "change from the old location)."
+ elog "If you use lighttpd, see lighttpd_nut.conf in the documentation."
+ fi
+
+ # this must be done after all of the install phases
+ for i in "${D}"/etc/nut/*.sample ; do
+ mv "${i}" "${i/.sample/}"
+ done
+
+ dodoc AUTHORS ChangeLog docs/*.txt MAINTAINERS NEWS README TODO UPGRADING || die
+
+ newdoc lib/README README.lib || die
+ newdoc "${FILESDIR}"/lighttpd_nut.conf-2.2.0 lighttpd_nut.conf || die
+
+ docinto cables
+ dodoc docs/cables/* || die
+
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsd upsd || die
+ newinitd "${FILESDIR}"/nut-2.2.2-init.d-upsdrv upsdrv || die
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsmon upsmon || die
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upslog upslog || die
+ newinitd "${FILESDIR}"/nut.powerfail.initd nut.powerfail || die
+
+ keepdir /var/lib/nut
+
+ einfo "Setting up permissions on files and directories"
+ fperms 0700 /var/lib/nut
+ fowners nut:nut /var/lib/nut
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval fperms 0640 ${NUT_PRIVATE_FILES}
+ eval fowners root:nut ${NUT_PRIVATE_FILES}
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval fperms 0644 ${NUT_PUBLIC_FILES}
+ eval fowners root:root ${NUT_PUBLIC_FILES}
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ if use cgi; then
+ eval fperms 0644 ${NUT_CGI_FILES}
+ eval fowners root:root ${NUT_CGI_FILES}
+ fi
+
+ # this is installed for 2.4 and fbsd guys
+ if ! has_version virtual/udev; then
+ einfo "Installing non-udev hotplug support"
+ insinto /etc/hotplug/usb
+ insopts -m 755
+ doins scripts/hotplug/nut-usbups.hotplug
+ fi
+
+ dobashcomp "${S}"/scripts/misc/nut.bash_completion
+}
+
+pkg_postinst() {
+ # this is to ensure that everybody that installed old versions still has
+ # correct permissions
+
+ chown nut:nut "${ROOT}"/var/lib/nut 2>/dev/null
+ chmod 0700 "${ROOT}"/var/lib/nut 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval chown root:nut "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
+ eval chmod 0640 "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval chown root:root "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
+ eval chmod 0644 "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ if use cgi; then
+ eval chown root:root "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
+ eval chmod 0644 "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
+ fi
+
+ warningmsg elog
+}
+
+warningmsg() {
+ msgfunc="$1"
+ [ -z "$msgfunc" ] && die "msgfunc not specified in call to warningmsg!"
+ ${msgfunc} "Please note that NUT now runs under the 'nut' user."
+ ${msgfunc} "NUT is in the uucp group for access to RS-232 UPS."
+ ${msgfunc} "However if you use a USB UPS you may need to look at the udev or"
+ ${msgfunc} "hotplug rules that are installed, and alter them suitably."
+ ${msgfunc} ''
+ ${msgfunc} "You are strongly advised to read the UPGRADING file provided by upstream."
+ ${msgfunc} ''
+ ${msgfunc} "Please note that upsdrv is NOT automatically started by upsd anymore."
+ ${msgfunc} "If you have multiple UPS units, you can use their NUT names to"
+ ${msgfunc} "have a service per UPS:"
+ ${msgfunc} "ln -s /etc/init.d/upsdrv /etc/init.d/upsdrv.\$UPSNAME"
+ ${msgfunc} ''
+ ${msgfunc} 'If you want apcupsd to power off your UPS when it'
+ ${msgfunc} 'shuts down your system in a power failure, you must'
+ ${msgfunc} 'add nut.powerfail to your shutdown runlevel:'
+ ${msgfunc} ''
+ ${msgfunc} 'rc-update add nut.powerfail shutdown'
+ ${msgfunc} ''
+
+}
diff --git a/sys-power/nut/nut-2.7.4.ebuild b/sys-power/nut/nut-2.7.4.ebuild
new file mode 100644
index 000000000000..a767415e64b7
--- /dev/null
+++ b/sys-power/nut/nut-2.7.4.ebuild
@@ -0,0 +1,269 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit autotools bash-completion-r1 eutils fixheadtails multilib user systemd flag-o-matic toolchain-funcs
+
+MY_P=${P/_/-}
+
+DESCRIPTION="Network-UPS Tools"
+HOMEPAGE="http://www.networkupstools.org/"
+# Nut mirrors are presently broken
+SRC_URI="http://random.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz
+ http://www.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~x86-fbsd"
+
+IUSE="cgi ipmi snmp +usb selinux ssl tcpd xml zeroconf"
+CDEPEND="
+ cgi? ( >=media-libs/gd-2[png] )
+ snmp? ( net-analyzer/net-snmp )
+ usb? ( virtual/libusb:0 )
+ ssl? ( >=dev-libs/openssl-1 )
+ tcpd? ( sys-apps/tcp-wrappers )
+ xml? ( >=net-libs/neon-0.25.0 )
+ ipmi? ( sys-libs/freeipmi )
+ zeroconf? ( net-dns/avahi )
+ virtual/udev"
+DEPEND="$CDEPEND
+ >=sys-apps/sed-4
+ virtual/pkgconfig"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-nut )
+"
+
+S=${WORKDIR}/${MY_P}
+
+# Bug #480664 requested UPS_DRIVERS_IUSE for more flexibility in building this package
+SERIAL_DRIVERLIST="al175 bcmxcp belkin belkinunv bestfcom bestfortress bestuferrups bestups dummy-ups etapro everups gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino safenet solis tripplite tripplitesu upscode2 victronups powerpanel blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old apcupsd-ups riello_ser nutdrv_qx"
+SNMP_DRIVERLIST="snmp-ups"
+USB_LIBUSB_DRIVERLIST="usbhid-ups bcmxcp_usb tripplite_usb blazer_usb richcomm_usb riello_usb nutdrv_qx"
+USB_DRIVERLIST=${USB_LIBUSB_DRIVERLIST}
+#HAL_DRIVERLIST="usbhid-ups bcmxcp_usb tripplite_usb blazer_usb riello_usb nutdrv_qx"
+NEONXML_DRIVERLIST="netxml-ups"
+IPMI_DRIVERLIST="nut-ipmipsu"
+# Now we build from it:
+for name in ${SERIAL_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} +ups_drivers_${name}"
+done
+for name in ${USB_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} +ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( usb )"
+done
+for name in ${NEONXML_DRIVERLIST}; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( xml )"
+done
+for name in ${SNMP_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( snmp )"
+done
+for name in ${IPMI_DRIVERLIST} ; do
+ IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
+ REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( ipmi )"
+done
+IUSE="${IUSE} ${IUSE_UPS_DRIVERS}"
+
+# public files should be 644 root:root
+NUT_PUBLIC_FILES="/etc/nut/{ups,upssched}.conf"
+# private files should be 640 root:nut - readable by nut, writeable by root,
+NUT_PRIVATE_FILES="/etc/nut/{upsd.conf,upsd.users,upsmon.conf}"
+# public files should be 644 root:root, only installed if USE=cgi
+NUT_CGI_FILES="/etc/nut/{{hosts,upsset}.conf,upsstats{,-single}.html}"
+
+pkg_setup() {
+ enewgroup nut 84
+ enewuser nut 84 -1 /var/lib/nut nut,uucp
+ # As of udev-104, NUT must be in uucp and NOT in tty.
+ gpasswd -d nut tty 2>/dev/null
+ gpasswd -a nut uucp 2>/dev/null
+ # in some cases on old systems it wasn't in the nut group either!
+ gpasswd -a nut nut 2>/dev/null
+ warningmsg ewarn
+}
+
+src_prepare() {
+ #ht_fix_file configure.in
+
+ epatch "${FILESDIR}/nut-2.7.2/nut-2.7.2-no-libdummy.patch"
+ epatch "${FILESDIR}"/${PN}-2.6.2-lowspeed-buffer-size.patch
+ #epatch "${FILESDIR}"/${PN}-2.6.3-CVE-2012-2944.patch
+ #epatch "${FILESDIR}"/${PN}-2.6.5-freeipmi_fru.patch
+ #epatch "${FILESDIR}"/${PN}-2.7.1-fix-scanning.patch
+ epatch "${FILESDIR}"/${PN}-2.7.1-snmpusb-order.patch
+
+ sed -e "s:GD_LIBS.*=.*-L/usr/X11R6/lib \(.*\) -lXpm -lX11:GD_LIBS=\"\1:" \
+ -e '/systemdsystemunitdir=.*echo.*sed.*libdir/s,^,#,g' \
+ -i configure.ac || die
+
+ sed -e "s:52.nut-usbups.rules:70-nut-usbups.rules:" \
+ -i scripts/udev/Makefile.am || die
+
+ rm -f ltmain.sh m4/lt* m4/libtool.m4
+
+ sed -i \
+ -e 's:@LIBSSL_LDFLAGS@:@LIBSSL_LIBS@:' \
+ lib/libupsclient{.pc,-config}.in || die #361685
+
+ eautoreconf
+}
+
+src_configure() {
+ local myconf
+ append-flags -fno-lto
+ tc-export CC
+ tc-export CXX
+ tc-export AR
+
+ local UPS_DRIVERS=""
+ for u in $USE ; do
+ u2=${u#ups_drivers_}
+ [[ "${u}" != "${u2}" ]] && UPS_DRIVERS="${UPS_DRIVERS} ${u2}"
+ done
+ UPS_DRIVERS="${UPS_DRIVERS# }" UPS_DRIVERS="${UPS_DRIVERS% }"
+ myconf="${myconf} --with-drivers=${UPS_DRIVERS// /,}"
+
+ use cgi && myconf="${myconf} --with-cgipath=/usr/share/nut/cgi"
+
+ # TODO: USE flag for sys-power/powerman
+ econf \
+ --sysconfdir=/etc/nut \
+ --datarootdir=/usr/share/nut \
+ --datadir=/usr/share/nut \
+ --disable-static \
+ --with-statepath=/var/lib/nut \
+ --with-drvpath=/$(get_libdir)/nut \
+ --with-htmlpath=/usr/share/nut/html \
+ --with-user=nut \
+ --with-group=nut \
+ --with-logfacility=LOG_DAEMON \
+ --with-dev \
+ --with-serial \
+ --without-powerman \
+ $(use_with cgi) \
+ $(use_with ipmi) \
+ $(use_with ipmi freeipmi) \
+ $(use_with snmp) \
+ $(use_with ssl) \
+ $(use_with tcpd wrap) \
+ $(use_with usb) \
+ $(use_with xml neon) \
+ $(use_with zeroconf avahi) \
+ $(systemd_with_unitdir) \
+ ${myconf}
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ find "${D}" -name '*.la' -exec rm -f {} +
+
+ dodir /sbin
+ dosym /usr/sbin/upsdrvctl /sbin/upsdrvctl
+
+ if use cgi; then
+ elog "CGI monitoring scripts are installed in /usr/share/nut/cgi."
+ elog "copy them to your web server's ScriptPath to activate (this is a"
+ elog "change from the old location)."
+ elog "If you use lighttpd, see lighttpd_nut.conf in the documentation."
+ fi
+
+ # this must be done after all of the install phases
+ for i in "${D}"/etc/nut/*.sample ; do
+ mv "${i}" "${i/.sample/}"
+ done
+
+ dodoc AUTHORS ChangeLog docs/*.txt MAINTAINERS NEWS README TODO UPGRADING || die
+
+ newdoc lib/README README.lib || die
+ newdoc "${FILESDIR}"/lighttpd_nut.conf-2.2.0 lighttpd_nut.conf || die
+
+ docinto cables
+ dodoc docs/cables/* || die
+
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsd upsd || die
+ newinitd "${FILESDIR}"/nut-2.2.2-init.d-upsdrv upsdrv || die
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsmon upsmon || die
+ newinitd "${FILESDIR}"/nut-2.6.5-init.d-upslog upslog || die
+ newinitd "${FILESDIR}"/nut.powerfail.initd nut.powerfail || die
+
+ keepdir /var/lib/nut
+
+ einfo "Setting up permissions on files and directories"
+ fperms 0700 /var/lib/nut
+ fowners nut:nut /var/lib/nut
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval fperms 0640 ${NUT_PRIVATE_FILES}
+ eval fowners root:nut ${NUT_PRIVATE_FILES}
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval fperms 0644 ${NUT_PUBLIC_FILES}
+ eval fowners root:root ${NUT_PUBLIC_FILES}
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ if use cgi; then
+ eval fperms 0644 ${NUT_CGI_FILES}
+ eval fowners root:root ${NUT_CGI_FILES}
+ fi
+
+ # this is installed for 2.4 and fbsd guys
+ if ! has_version virtual/udev; then
+ einfo "Installing non-udev hotplug support"
+ insinto /etc/hotplug/usb
+ insopts -m 755
+ doins scripts/hotplug/nut-usbups.hotplug
+ fi
+
+ dobashcomp "${S}"/scripts/misc/nut.bash_completion
+}
+
+pkg_postinst() {
+ # this is to ensure that everybody that installed old versions still has
+ # correct permissions
+
+ chown nut:nut "${ROOT}"/var/lib/nut 2>/dev/null
+ chmod 0700 "${ROOT}"/var/lib/nut 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval chown root:nut "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
+ eval chmod 0640 "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ eval chown root:root "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
+ eval chmod 0644 "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
+
+ # Do not remove eval here, because the variables contain shell expansions.
+ if use cgi; then
+ eval chown root:root "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
+ eval chmod 0644 "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
+ fi
+
+ warningmsg elog
+}
+
+warningmsg() {
+ msgfunc="$1"
+ [ -z "$msgfunc" ] && die "msgfunc not specified in call to warningmsg!"
+ ${msgfunc} "Please note that NUT now runs under the 'nut' user."
+ ${msgfunc} "NUT is in the uucp group for access to RS-232 UPS."
+ ${msgfunc} "However if you use a USB UPS you may need to look at the udev or"
+ ${msgfunc} "hotplug rules that are installed, and alter them suitably."
+ ${msgfunc} ''
+ ${msgfunc} "You are strongly advised to read the UPGRADING file provided by upstream."
+ ${msgfunc} ''
+ ${msgfunc} "Please note that upsdrv is NOT automatically started by upsd anymore."
+ ${msgfunc} "If you have multiple UPS units, you can use their NUT names to"
+ ${msgfunc} "have a service per UPS:"
+ ${msgfunc} "ln -s /etc/init.d/upsdrv /etc/init.d/upsdrv.\$UPSNAME"
+ ${msgfunc} ''
+ ${msgfunc} 'If you want apcupsd to power off your UPS when it'
+ ${msgfunc} 'shuts down your system in a power failure, you must'
+ ${msgfunc} 'add nut.powerfail to your shutdown runlevel:'
+ ${msgfunc} ''
+ ${msgfunc} 'rc-update add nut.powerfail shutdown'
+ ${msgfunc} ''
+
+}