diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2013-08-12 18:35:18 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2013-08-12 18:35:18 +0000 |
commit | b69d02c9bbbb0d2e41bd9be4c8eaf8420b188a31 (patch) | |
tree | 77940a943ec04569337b694cdbccf0e9b640d39e /sys-power/nut | |
parent | Move to distutils-r1 (diff) | |
download | historical-b69d02c9bbbb0d2e41bd9be4c8eaf8420b188a31.tar.gz historical-b69d02c9bbbb0d2e41bd9be4c8eaf8420b188a31.tar.bz2 historical-b69d02c9bbbb0d2e41bd9be4c8eaf8420b188a31.zip |
Add support for IPMI drivers, upslog daemon, EAPI5, bash-completion-r1. Fix typos in init scripts. Fix Bug #478556: systemd install location.
Package-Manager: portage-2.2.0_alpha185/cvs/Linux x86_64
Diffstat (limited to 'sys-power/nut')
-rw-r--r-- | sys-power/nut/ChangeLog | 13 | ||||
-rw-r--r-- | sys-power/nut/Manifest | 23 | ||||
-rw-r--r-- | sys-power/nut/files/nut-2.6.5-freeipmi_fru.patch | 448 | ||||
-rwxr-xr-x | sys-power/nut/files/nut-2.6.5-init.d-upsd | 38 | ||||
-rw-r--r-- | sys-power/nut/files/nut-2.6.5-init.d-upslog | 31 | ||||
-rwxr-xr-x | sys-power/nut/files/nut-2.6.5-init.d-upsmon | 30 | ||||
-rw-r--r-- | sys-power/nut/metadata.xml | 3 | ||||
-rw-r--r-- | sys-power/nut/nut-2.6.5-r1.ebuild | 229 |
8 files changed, 797 insertions, 18 deletions
diff --git a/sys-power/nut/ChangeLog b/sys-power/nut/ChangeLog index a6a55e58d0ef..3c7e1af224ff 100644 --- a/sys-power/nut/ChangeLog +++ b/sys-power/nut/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for sys-power/nut -# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-power/nut/ChangeLog,v 1.106 2012/12/03 02:05:51 ssuominen Exp $ +# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-power/nut/ChangeLog,v 1.107 2013/08/12 18:35:11 robbat2 Exp $ + +*nut-2.6.5-r1 (12 Aug 2013) + + 12 Aug 2013; Robin H. Johnson <robbat2@gentoo.org> + +files/nut-2.6.5-freeipmi_fru.patch, +files/nut-2.6.5-init.d-upsd, + +files/nut-2.6.5-init.d-upslog, +files/nut-2.6.5-init.d-upsmon, + +nut-2.6.5-r1.ebuild, metadata.xml: + Add support for IPMI drivers, upslog daemon, EAPI5, bash-completion-r1. Fix + typos in init scripts. Fix Bug #478556: systemd install location. 03 Dec 2012; Samuli Suominen <ssuominen@gentoo.org> nut-2.6.0-r1.ebuild, nut-2.6.2.ebuild, nut-2.6.3.ebuild, nut-2.6.5.ebuild: diff --git a/sys-power/nut/Manifest b/sys-power/nut/Manifest index d9993ea29d5a..13000cdc7574 100644 --- a/sys-power/nut/Manifest +++ b/sys-power/nut/Manifest @@ -1,6 +1,3 @@ ------BEGIN PGP SIGNED MESSAGE----- -Hash: SHA256 - AUX lighttpd_nut.conf-2.2.0 971 SHA256 f0b1b3e574766557dbf92704eb4cf81b166bb4db68ddecee581cb8b0b6638f65 SHA512 011ed0bc5fc66f7e7bb3d307cc3a548d6c424ce38a76cfe73b593e5be5a03e94e977b1539e5a96317f35662c41171528c98dd7bdab3cebc2a82cab804437ba26 WHIRLPOOL d221a8e6e64bcb578873d86b3ea1c6a6028649918799a5953e5175c141503f9d00aeeb4546820cd74af76fe99ce29070106621279abc711f2e8fd58aa659fc18 AUX nut-2.2.2-init.d-upsd 790 SHA256 81b0b82850d528d682544b452599159510dd93ba43e2c6133d0c9aab0b4c0210 SHA512 fcc15f6c272842711bce1bf6af46cb9371722479da944a3c191be2ad36327f4d8b74d8f05b2a06dabc1de04817c61d9eb0842618d43e4501c5800d778fc9bd9d WHIRLPOOL 6a52d222d9f2f5347ad568d5a4ccef7cbee1c23c76ad7aadef252ca9b6f9f5d8cdfa991c915f7a2f1335a3f8fc38d50961854158824625fedcbce5930535192c AUX nut-2.2.2-init.d-upsdrv 979 SHA256 72f41864cef57aea0617f75cc6478c1c8cffc979e0e4136d179dcf665915fa0d SHA512 89b59ac77466cd52a30307c43aea099a90e96886edf8647dcc0e3bd37e1bf57297e14ce1564270ffb4c39e549e8f1338f3260e5c4bd6339dc0bb6b3b47184684 WHIRLPOOL 2abe2c1b7703bf6ef5333776aa4d7cc21b85af1a1ca0746b529e796492c54cac0c6680968027c51b316e96eb691c06c470f6f7ae1275ff469fa8708dd289c236 @@ -9,6 +6,10 @@ AUX nut-2.4.1-no-libdummy.patch 791 SHA256 c9cf34980e79a4b9f07c338d10bc4ef4e9060 AUX nut-2.4.3-lowspeed-buffer-size.patch 725 SHA256 74ed963e039413472907ebdbba07dd59ebf8e721214f32ce0fabe169597dc9b7 SHA512 cc7342c7f430bdef86e07634ed08af119ede5797544776378ed763e6401f67f402f121f89897b16b9a13666f2f445f2dacbc12160fccfdcedc27fd74478e603c WHIRLPOOL 3dca1e2317630da1e74619e1b60afdedf53d62dcf09633874a68341137e009d3afa4d8fdfc32f46abc2b8c45baa0787826b9e938358cb04862899a3e9f7b66f3 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 788 SHA256 08227f441d2f5c1a78e3ae567ddd36254775e72d2b0f18ea755f4dbc92419e2d SHA512 c4df416e27b368b25d8858d6c591efedaa72bb0fb6989bb5b3388c07221681d0e818269bc89f938c29237edbb6695cd7c1cbb49a3fb9ba5aaeb1481cb50ac659 WHIRLPOOL be8aad6b2d1fdcb9e465cb1792fa7df5db7e523b42215b19211fcdf6fcc4b46ad35913b9ad5fedd14c32898c1669fadacdb93bfb401a12989d1e80e503f02347 +AUX nut-2.6.5-init.d-upslog 691 SHA256 c9412210a3606a0d9ce0b88a8db59307a1c699a10c7d71392a29b50f1bf6b7e3 SHA512 d4207be179c52cce1b42eca3f834989c95cfbfa19bfb7c42d7f8fb84fd80ed1a554cff5283b73fabb89c8d075858af84aa6eec920c8b99c823176b0c9421ab07 WHIRLPOOL 694718cca15c1fdcf8a0de438ebc55210bac32bcfaf4674806ea9ddd3927dd1b503a1baa42bc4d456934655c2d4b3fb4c32d124ef2508ee42cffac89f5824e1c +AUX nut-2.6.5-init.d-upsmon 675 SHA256 654b74fce8e63e98abcab3c7e0b1903a39bd8672dcd5cf740b10209859b1d012 SHA512 4f797f8c72679410c9897d41bbccd4b842d08984e31e8a4729e823636970919854680162a88180cb73d3467db09d3c586d4c0e964bc0ddb5895cd32a88db7504 WHIRLPOOL 587435910808e3eac012b4d8af705aee631aeaedaceaf08598bb384a433aafe3f54b3dd254ee9654dfc85d73b9b53656d6b97674c5edb1ef580fc36134584553 AUX nut.powerfail.initd 1395 SHA256 3ef933724169dbe08645fed19674a1576ced5f54a88985b5b32baf2a9c178ae7 SHA512 2c7bdb0f4ada8014a09bc21205cafa49496950c49f3bfed6b21fe7e400b818024e5fbd402c0bccca5bc4624606cb52b10f87b0074a4d7372e1b67976d5ca68f9 WHIRLPOOL 7163a0b0203b9d96e4317468bd2f2f7af41fb755a7312afdbe58dadce9cb8fc78b716ca35a19fc8160159fc5376d0bb779c4d3a31d1e72abf5026ddef749c4d1 DIST nut-2.6.0.tar.gz 1703273 SHA256 febaa230b6b5f0ad27d780851047527d36c8c7a34e557b3832d6d55174d7a0d5 SHA512 82bf03ef01931c819d550babed48806a45411083bc0a79d1e10e44ec798fb07032e0f8eda409ddd591faf4506955bd98656afc97bc6d357276de70d0ce15b775 WHIRLPOOL e7da975a7c1eafd3b9d7e90456b6924ded74e9576746a91e3692b9e58dfa24878567596fa850776a88542673a35098cc0b22ca79ec3c597dccf03ee2119c001c DIST nut-2.6.2.tar.gz 1897691 SHA256 343554add0713348f8b09bca8d83eee2eb2ae8bad9cdad9a39e0f0e2d0f5d375 SHA512 848dfb9e1aebdab47a9892e4f2c5cba7afb87f422b7edcf5d4c8843dda917edf86d8f747ff655b2026635eb803d09c4d393b212279907e371308d3efe7bd8145 WHIRLPOOL 8beb421f168f546bfa1a763db411074dbd5ab8da8638d33c9ee0106f9102332c8ac5c8beeda0f71d5dfe89e09e0f651a4bc8d3a49e2f2177fb4c935d23bb8e68 @@ -17,17 +18,7 @@ DIST nut-2.6.5.tar.gz 2038832 SHA256 618df71cf1ca6e3700d1d3c282773a2dec85f9f2032 EBUILD nut-2.6.0-r1.ebuild 6850 SHA256 631a5a8351d8d3ac3eb9c25aa4a1a51a91eb142fc52d4b08d5610df48d9dab1e SHA512 433a8895d990c7b4c526074182a163ecebc318979a34bd38cae69bbdfa6b26e5300038f19f38ea472bb4c78b8e83e3c6dd563680fa1edbbaaf19e3a76aa69a34 WHIRLPOOL d5cc9028b62ea88ac540867879dc288db1e7631b33c3362a7dc5e9f7ab02ffc4276b5f92e9ef6b918e57114d0ccf5653140b28fe61dcb2e427f2b806b4a3eac5 EBUILD nut-2.6.2.ebuild 6851 SHA256 9b08a7b7c0aebcf83d7b5fbbaffab61f03e0624a32e08f431d52c13c49b85ce1 SHA512 762b239fb932219df2e208c5041ce76148c38b182ccca06f8dd68424ce3bf0bb62046716228cb33104d5e0d5f7b9375bee62d2678cc53811aacbcc0ac843ef29 WHIRLPOOL 046de3ae8d6f39c2e516dfef58e4495ebc0c5a48cce8b92d342d95c5e919c56f9a69b118b0837d60195c11f91d1a48f813b9845bd53809479f102ef0505b991f EBUILD nut-2.6.3.ebuild 6960 SHA256 4c4a1d0fe132a96070c85e547a700a066034014d8a57c8dbcfc22ea27a32c1c4 SHA512 a39b9e4b642027e7fe633e828d3eb56c2c66267fef211a2bd2f0eee5dc86eb7d48018e0f4d0f08d0ad11c5ce7712e14410beec3429155f2aa9bcdc703e56bd26 WHIRLPOOL e83365c8231b15e9b8f42f3e0835efce90340ef662e64c89b1c6ee70c6919703191a5ffea63ea1500345357e7097d0db3eaf0f695220c2e620c60c70b1dac1d6 +EBUILD nut-2.6.5-r1.ebuild 7279 SHA256 cdd8e37619931f42fef92729034fc062ad6ec1260ac42ca6bf729d80c3c3ff4d SHA512 0a8a743b46d0d72b6e99626a157f6f560b551829a1c629b5c500231c4c077e1add3a8cedaa9c54988d5ad65fca856bc3d9e5350e4d8e9a2b22798c26f8ed779a WHIRLPOOL 4a88d17a17ba9d1db586a8635c1c65cd2b40038b30f92174dee8d856254986d84d23a21ef30b0a49bcd228242af8b140a69ae93465a74af353db5351e4aa65ae EBUILD nut-2.6.5.ebuild 6965 SHA256 dfe83c82a951c0abbaa2b6f74178bba4c9c2286df7cfa011c86adffd639e98b4 SHA512 5c0699443346fcafb49de4dae553021fbb6d6487eace3f912a2841b9775c5220caa4db308c9c5199b3145030180a48d685bfc840201e2a3e5c598d639a420340 WHIRLPOOL 318e34e854abb251cab9749664584f2a3f4086c7d50b0a6a1360dad356068b37fe7b87ceb7cf613720d5802c40db9a219d812467b73045dea60083d25a7e1fda -MISC ChangeLog 22423 SHA256 264f013a72151a16ccbfe9123bcb7e34b9d64c2e929f693c35a79793b1c0e331 SHA512 2e78d2b9bf8d37b955426930ec91c385aa8130157f195879b37ce65142a84c5f43aecb657467987fa7b4fb172128968e758d3bccb9fe8e850dfec33e83f4bb07 WHIRLPOOL b6b3769c1a30578dc73077aaf704b290b5730971369aec04c6c7e113100ea9e9503e2b3b2614eff6ed3f5da842224e07a846df06aadf50873b6ea1556d859334 -MISC metadata.xml 242 SHA256 e82b2cc8fc830e2925c899d4b88c444b0b52e2de9f1bc28d5e08b545a195854f SHA512 43e74caad0e70954140d742d8718761d443f01372a159b54a5af5f677f8a9bf5af83cbdc351d62b4d9eed8f60e440d32bab76c0694da29c5eabaeb4142b14cd3 WHIRLPOOL ecccd3ae24c1bf48abcfbbe9dd33f3886f51b35c968e38e0d2e94055ecef43104594b8312ec3c864483e8ab9bfdb217ad2d02f40652b07acb5f1134d9fc09555 ------BEGIN PGP SIGNATURE----- -Version: GnuPG v2.0.19 (GNU/Linux) - -iQEcBAEBCAAGBQJQvAkBAAoJEEdUh39IaPFNZg8H/0TJySvx0gYVKo0bv5LksjtG -76k3wbDmg1Z5tHaLSquYPqdSWE8qN5wTyXa3dvzCx7Y1RzAbJ2ksHm6Rh3A+ILE7 -uyxltjlApG/Z9dVuceo6OjFWUnVZPPh3+5WkbcYmHqRjK/yYkCBr3p74ASBIZUMO -BFLZq+gRE04V2TChvWuxLpBAHiLLQthEkNJ6j4wwrX5ltES7Rh3ngkFUsGhnPhhk -gW3aelLf8kj6zuNETow170sRfDDAG2Wf82LdC7ZAXQnriWLv9USQYwgT/AqvPK77 -MagAlXwiDTO+e4+gmChVMBuDK9tnKdtmPPxnIllx1wrmCBUnH37l2Ex+SAoAMT0= -=FQP8 ------END PGP SIGNATURE----- +MISC ChangeLog 22823 SHA256 e773a81ef9c366dd53d6aacb80a461c141a951005d6e4bf6425d5bcd7bc5a917 SHA512 c1068af1455e1b1b802e05822816fcb5f9d97b06660bf804623f039336b7785f0503749065194591e2253c47c28abc15a57125bea5c6274b550679951e2db09d WHIRLPOOL 2b0707505b1e3c3e58f171c430ff59be441905a8ed13b745e3cc073383765e4238a33ef55c517956f02efa95089967bd3c7bb83fcac02f2040a3af0234c2b062 +MISC metadata.xml 314 SHA256 f640cffd9cf33286ab7e0a900f89fe6579320eccfc10422a7ffbf064a1d6c34f SHA512 1b3320b2a91551affc8e63ea7524ea853e1bdb424cc3afae52fd1c0ad8178b70d5533ca7ccb1691e487fd5987981311358adbbc38d18f63e998cb911dc02c063 WHIRLPOOL 71709b19f841c823bcca9a6c7e1d1b76b0f7e949b6d37cb5585f23cc36b12e6078b1c4f1d3d72a82f5d9826e0c1ea644534c164d961f4ce047faffc87b114ab4 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 100755 index 000000000000..4ca7bde9d9f9 --- /dev/null +++ b/sys-power/nut/files/nut-2.6.5-init.d-upsd @@ -0,0 +1,38 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-power/nut/files/nut-2.6.5-init.d-upsd,v 1.1 2013/08/12 18:35:12 robbat2 Exp $ + +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 1s + 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..3e5d9b3bf7e7 --- /dev/null +++ b/sys-power/nut/files/nut-2.6.5-init.d-upslog @@ -0,0 +1,31 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-power/nut/files/nut-2.6.5-init.d-upslog,v 1.1 2013/08/12 18:35:12 robbat2 Exp $ + +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 100755 index 000000000000..0c3fb9221214 --- /dev/null +++ b/sys-power/nut/files/nut-2.6.5-init.d-upsmon @@ -0,0 +1,30 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-power/nut/files/nut-2.6.5-init.d-upsmon,v 1.1 2013/08/12 18:35:12 robbat2 Exp $ + +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/metadata.xml b/sys-power/nut/metadata.xml index 557ca512951a..a4709d5a95d9 100644 --- a/sys-power/nut/metadata.xml +++ b/sys-power/nut/metadata.xml @@ -5,4 +5,7 @@ <email>robbat2@gentoo.org</email> <name>Robin H. Johnson</name> </maintainer> + <use> + <flag name="ipmi">Support IPMI-based UPSes.</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..2a78a4f930a1 --- /dev/null +++ b/sys-power/nut/nut-2.6.5-r1.ebuild @@ -0,0 +1,229 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-power/nut/nut-2.6.5-r1.ebuild,v 1.1 2013/08/12 18:35:11 robbat2 Exp $ + +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 ssl tcpd xml" + +RDEPEND="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="$RDEPEND + >=sys-apps/sed-4 + virtual/pkgconfig" + +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} '' + +} |