Gentoo Archives: gentoo-commits

From: Sergey Popov <pinkbyte@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-power/apcupsd/
Date: Wed, 26 Sep 2018 15:07:43
Message-Id: 1537974444.c61bad97547bf51723019b3fc91e3280432bcd38.pinkbyte@gentoo
1 commit: c61bad97547bf51723019b3fc91e3280432bcd38
2 Author: Sergey Popov <pinkbyte <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 26 15:07:07 2018 +0000
4 Commit: Sergey Popov <pinkbyte <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 26 15:07:24 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c61bad97
7
8 sys-power/apcupsd: revision bump
9
10 Bump EAPI to 6. Fix hardcoded path to mail utility from virtual/mailx
11
12 Package-Manager: Portage-2.3.49, Repoman-2.3.10
13
14 sys-power/apcupsd/apcupsd-3.14.14-r2.ebuild | 138 ++++++++++++++++++++++++++++
15 1 file changed, 138 insertions(+)
16
17 diff --git a/sys-power/apcupsd/apcupsd-3.14.14-r2.ebuild b/sys-power/apcupsd/apcupsd-3.14.14-r2.ebuild
18 new file mode 100644
19 index 00000000000..9212cf4864c
20 --- /dev/null
21 +++ b/sys-power/apcupsd/apcupsd-3.14.14-r2.ebuild
22 @@ -0,0 +1,138 @@
23 +# Copyright 1999-2018 Gentoo Foundation
24 +# Distributed under the terms of the GNU General Public License v2
25 +
26 +EAPI=6
27 +
28 +inherit linux-info flag-o-matic systemd udev
29 +
30 +DESCRIPTION="APC UPS daemon with integrated tcp/ip remote shutdown"
31 +HOMEPAGE="http://www.apcupsd.org/"
32 +SRC_URI="mirror://sourceforge/apcupsd/${P}.tar.gz"
33 +
34 +LICENSE="GPL-2"
35 +SLOT="0"
36 +KEYWORDS="~amd64 ~arm ~ppc ~x86 ~x86-fbsd"
37 +IUSE="snmp +usb +modbus cgi nls gnome kernel_linux"
38 +
39 +DEPEND="
40 + || ( >=sys-apps/util-linux-2.23[tty-helpers(-)]
41 + sys-freebsd/freebsd-ubin
42 + )
43 + modbus? ( usb? ( virtual/libusb:0 ) )
44 + cgi? ( >=media-libs/gd-1.8.4 )
45 + nls? ( sys-devel/gettext )
46 + snmp? ( >=net-analyzer/net-snmp-5.7.2 )
47 + gnome? ( >=x11-libs/gtk+-2.4.0:2
48 + dev-libs/glib:2
49 + >=gnome-base/gconf-2.0 )"
50 +RDEPEND="${DEPEND}
51 + virtual/mailx"
52 +
53 +CONFIG_CHECK="~USB_HIDDEV ~HIDRAW"
54 +ERROR_USB_HIDDEV="CONFIG_USB_HIDDEV: needed to access USB-attached UPSes"
55 +ERROR_HIDRAW="CONFIG_HIDRAW: needed to access USB-attached UPSes"
56 +
57 +DOCS=( ChangeLog ReleaseNotes )
58 +HTML_DOCS=( doc/manual )
59 +PATCHES=( "${FILESDIR}/${PN}-3.14.9-aliasing.patch" )
60 +
61 +pkg_setup() {
62 + if use kernel_linux && use usb && linux_config_exists; then
63 + check_extra_config
64 + fi
65 +}
66 +
67 +src_configure() {
68 + local myconf
69 + use cgi && myconf="${myconf} --enable-cgi --with-cgi-bin=/usr/libexec/${PN}/cgi-bin"
70 + if use usb; then
71 + myconf="${myconf} --with-upstype=usb --with-upscable=usb --enable-usb --with-dev= "
72 + use modbus && myconf="${myconf} --enable-modbus-usb"
73 + else
74 + myconf="${myconf} --with-upstype=apcsmart --with-upscable=smart --disable-usb"
75 + use modbus || myconf="${myconf} --disable-modbus"
76 + fi
77 +
78 + # We force the DISTNAME to gentoo so it will use gentoo's layout also
79 + # when installed on non-linux systems.
80 + econf \
81 + --sbindir=/sbin \
82 + --sysconfdir=/etc/apcupsd \
83 + --with-pwrfail-dir=/etc/apcupsd \
84 + --with-lock-dir=/run/apcupsd \
85 + --with-pid-dir=/run/apcupsd \
86 + --with-log-dir=/var/log \
87 + --with-nis-port=3551 \
88 + --enable-net --enable-pcnet \
89 + --with-distname=gentoo \
90 + $(use_enable snmp) \
91 + $(use_enable gnome gapcmon) \
92 + ${myconf} \
93 + APCUPSD_MAIL=$(type -p mail)
94 +}
95 +
96 +src_compile() {
97 + # Workaround for bug #280674; upstream should really just provide
98 + # the text files in the distribution, but I wouldn't count on them
99 + # doing that anytime soon.
100 + MANPAGER=$(type -p cat) \
101 + emake
102 +}
103 +
104 +src_install() {
105 + emake DESTDIR="${D}" install
106 + rm -f "${D}"/etc/init.d/halt || die
107 +
108 + insinto /etc/apcupsd
109 + newins examples/safe.apccontrol safe.apccontrol
110 + doins "${FILESDIR}"/apcupsd.conf
111 +
112 + doman doc/*.8 doc/*.5
113 +
114 + einstalldocs
115 +
116 + rm "${D}"/etc/init.d/apcupsd || die
117 + newinitd "${FILESDIR}/${PN}.init.4" "${PN}"
118 + newinitd "${FILESDIR}/${PN}.powerfail.init" "${PN}".powerfail
119 +
120 + systemd_dounit "${FILESDIR}"/${PN}.service
121 + systemd_dotmpfilesd "${FILESDIR}"/${PN}-tmpfiles.conf
122 +
123 + # remove hal settings, we don't really want to have it around still.
124 + rm -r "${D}"/usr/share/hal || die
125 +
126 + # replace it with our udev rules if we're in Linux
127 + if use kernel_linux; then
128 + udev_newrules "${FILESDIR}"/apcupsd-udev.rules 60-${PN}.rules
129 + fi
130 +
131 +}
132 +
133 +pkg_postinst() {
134 + if use cgi; then
135 + elog "The cgi-bin directory for ${PN} is /usr/libexec/${PN}/cgi-bin."
136 + elog "Set up your ScriptAlias or symbolic links accordingly."
137 + fi
138 +
139 + elog ""
140 + elog "Since version 3.14.0 you can use multiple apcupsd instances to"
141 + elog "control more than one UPS in a single box with openRC."
142 + elog "To do this, create a link between /etc/init.d/apcupsd to a new"
143 + elog "/etc/init.d/apcupsd.something, and it will then load the"
144 + elog "configuration file at /etc/apcupsd/something.conf."
145 + elog ""
146 +
147 + elog 'If you want apcupsd to power off your UPS when it'
148 + elog 'shuts down your system in a power failure, you must'
149 + elog 'add apcupsd.powerfail to your shutdown runlevel:'
150 + elog ''
151 + elog ' \e[01m rc-update add apcupsd.powerfail shutdown \e[0m'
152 + elog ''
153 +
154 + if use kernel_linux; then
155 + elog "Starting from version 3.14.9-r1, ${PN} installs udev rules"
156 + elog "for persistent device naming. If you have multiple UPS"
157 + elog "connected to the machine, you can point them to the devices"
158 + elog "in /dev/apcups/by-id directory."
159 + fi
160 +}