mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-21 10:37:22 -08:00
sys-power/nut: cleanup
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
This commit is contained in:
@@ -1,3 +1,2 @@
|
||||
DIST nut-2.7.4.tar.gz 2509831 BLAKE2B 367c687efd739150898a14c700d5fddbe22bf926522923e1842011ec49b67d6638620500c4eda50291feb474cc6eef39fff63764cb3e0fad5898abee981f8308 SHA512 320c4aff85d8a370c5eff77d33924fdfc3caf6a250620693cdd5bf3336b3a80d8a207488eee841bcf8b72fbad68fda4c074e63b99c56e7886716fc934122d11a
|
||||
DIST nut-2.8.0.tar.gz 3287640 BLAKE2B 6ad87e9c90920d45846d9c1311e8feeb3c36bfa506d62d938940c00d2fc7f7b30632d079a8ee969db624824ae4fd3e14e41e8acd1eda296e26a3aa340f186b94 SHA512 3c413ae54088045a713eb80cf1bdda474f41bb3b67c7c0248aa7a0c4d441dce1ff42627a2735273d7e36892d1f2eeb895220cf28af63fec2fa0c7a267f82d577
|
||||
DIST nut-2.8.2.tar.gz 5599935 BLAKE2B 87187293d8acda72c2d807d6f41f2601a318540f63a0ea93782b115402c6b43a0b61ecc710fd6de126d25e59dd4e03681f2b859a87549e9d5f7617ac7b2dad8c SHA512 b6f8f22318e4a4fcb8073a63132b1cb083952c665191b82a7d6765a61b859575a4b0c2ba84ed17cfb8c88d34179876d64520dd2f75f02fe8707b406da2c0821c
|
||||
|
||||
@@ -26,57 +26,6 @@
|
||||
<flag name="snmp">Includes all UPS drivers that use SNMP.</flag>
|
||||
<flag name="usb">Includes all UPS drivers that use USB.</flag>
|
||||
<flag name="xml">Includes all UPS drivers that use XML.</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>
|
||||
<upstream>
|
||||
<remote-id type="github">networkupstools/nut</remote-id>
|
||||
|
||||
@@ -1,274 +0,0 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
inherit autotools bash-completion-r1 desktop fixheadtails flag-o-matic systemd toolchain-funcs
|
||||
|
||||
MY_P=${P/_/-}
|
||||
|
||||
DESCRIPTION="Network-UPS Tools"
|
||||
HOMEPAGE="https://www.networkupstools.org/"
|
||||
SRC_URI="https://networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 arm ~arm64 ~ppc ppc64 ~riscv x86"
|
||||
|
||||
IUSE="cgi ipmi snmp +usb selinux split-usr ssl tcpd xml zeroconf"
|
||||
|
||||
CDEPEND="
|
||||
acct-group/nut
|
||||
acct-user/nut
|
||||
"
|
||||
|
||||
DEPEND="
|
||||
dev-libs/libltdl
|
||||
net-libs/libnsl:=
|
||||
virtual/udev
|
||||
cgi? ( >=media-libs/gd-2[png] )
|
||||
ipmi? ( sys-libs/freeipmi )
|
||||
snmp? ( net-analyzer/net-snmp:= )
|
||||
ssl? ( >=dev-libs/openssl-1:= )
|
||||
tcpd? ( sys-apps/tcp-wrappers )
|
||||
usb? ( virtual/libusb:0= )
|
||||
xml? ( >=net-libs/neon-0.25.0:= )
|
||||
zeroconf? ( net-dns/avahi )"
|
||||
|
||||
BDEPEND="
|
||||
${CDEPEND}
|
||||
virtual/pkgconfig"
|
||||
|
||||
RDEPEND="
|
||||
${CDEPEND}
|
||||
${DEPEND}
|
||||
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}"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PN}-2.7.1-snmpusb-order.patch
|
||||
"${FILESDIR}"/${PN}-2.6.2-lowspeed-buffer-size.patch
|
||||
"${FILESDIR}"/nut-openssl-1.1-support.patch
|
||||
"${FILESDIR}"/nut-2.7.4-py3.patch
|
||||
"${FILESDIR}"/nut-2.7.4-nut-scanner.patch
|
||||
"${FILESDIR}"/nut-2.7.4-slibtool.patch
|
||||
)
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
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 ltmain.sh m4/lt* m4/libtool.m4 || die
|
||||
|
||||
sed -e 's:@LIBSSL_LDFLAGS@:@LIBSSL_LIBS@:' \
|
||||
-i lib/libupsclient{.pc,-config}.in || die #361685
|
||||
|
||||
eautoreconf
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local myconf
|
||||
|
||||
filter-lto
|
||||
# bug #786702
|
||||
append-cxxflags -std=c++14
|
||||
|
||||
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 \
|
||||
--with-systemdsystemunitdir="$(systemd_get_systemunitdir)" \
|
||||
--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) \
|
||||
${myconf}
|
||||
}
|
||||
|
||||
src_install() {
|
||||
emake DESTDIR="${D}" install
|
||||
|
||||
find "${D}" -name '*.la' -delete || die
|
||||
|
||||
dodir /sbin
|
||||
use split-usr && 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/}" || die
|
||||
done
|
||||
|
||||
local DOCS=( AUTHORS ChangeLog docs/*.txt MAINTAINERS NEWS README TODO UPGRADING )
|
||||
einstalldocs
|
||||
|
||||
newdoc lib/README README.lib
|
||||
newdoc "${FILESDIR}"/lighttpd_nut.conf-2.2.0 lighttpd_nut.conf
|
||||
|
||||
docinto cables
|
||||
dodoc docs/cables/*
|
||||
|
||||
newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsd upsd
|
||||
newinitd "${FILESDIR}"/nut-2.2.2-init.d-upsdrv upsdrv
|
||||
newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsmon upsmon
|
||||
newinitd "${FILESDIR}"/nut-2.6.5-init.d-upslog upslog
|
||||
newinitd "${FILESDIR}"/nut.powerfail.initd nut.powerfail
|
||||
|
||||
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
|
||||
|
||||
newbashcomp "${S}"/scripts/misc/nut.bash_completion upsc
|
||||
bashcomp_alias upsc upscmd upsd upsdrvctl upsmon upsrw
|
||||
}
|
||||
|
||||
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} ''
|
||||
|
||||
}
|
||||
@@ -1,221 +0,0 @@
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit bash-completion-r1 flag-o-matic linux-info optfeature systemd
|
||||
inherit tmpfiles toolchain-funcs udev
|
||||
|
||||
MY_P=${P/_/-}
|
||||
|
||||
DESCRIPTION="Network-UPS Tools"
|
||||
HOMEPAGE="https://networkupstools.org/"
|
||||
|
||||
if [[ ${PV} == *9999 ]] ; then
|
||||
EGIT_REPO_URI="https://github.com/networkupstools/${PN}.git"
|
||||
inherit git-r3
|
||||
else
|
||||
SRC_URI="https://networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
|
||||
KEYWORDS="amd64 arm ~arm64 ~ppc ppc64 ~riscv x86"
|
||||
fi
|
||||
|
||||
S="${WORKDIR}/${MY_P}"
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
IUSE="cgi doc ipmi serial i2c +man snmp +usb modbus selinux split-usr ssl tcpd test xml zeroconf"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
DEPEND="
|
||||
acct-group/nut
|
||||
acct-user/nut
|
||||
dev-libs/libltdl
|
||||
virtual/udev
|
||||
cgi? ( >=media-libs/gd-2[png] )
|
||||
i2c? ( sys-apps/i2c-tools )
|
||||
ipmi? ( sys-libs/freeipmi )
|
||||
modbus? ( dev-libs/libmodbus )
|
||||
snmp? ( net-analyzer/net-snmp:= )
|
||||
ssl? ( >=dev-libs/openssl-1:= )
|
||||
tcpd? ( sys-apps/tcp-wrappers )
|
||||
usb? ( virtual/libusb:1 )
|
||||
xml? ( >=net-libs/neon-0.25.0:= )
|
||||
zeroconf? ( net-dns/avahi )
|
||||
"
|
||||
BDEPEND="
|
||||
virtual/pkgconfig
|
||||
man? ( app-text/asciidoc )
|
||||
test? ( dev-util/cppunit )
|
||||
"
|
||||
RDEPEND="
|
||||
${DEPEND}
|
||||
selinux? ( sec-policy/selinux-nut )
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/${PN}-2.6.2-lowspeed-buffer-size.patch"
|
||||
)
|
||||
|
||||
pkg_pretend() {
|
||||
if use i2c; then
|
||||
CONFIG_CHECK="~I2C_CHARDEV"
|
||||
ERROR_I2C_CHARDEV="You must enable I2C_CHARDEV in your kernel to continue"
|
||||
fi
|
||||
if use usb; then
|
||||
CONFIG_CHECK+=" ~HIDRAW ~USB_HIDDEV"
|
||||
ERROR_HIDRAW="HIDRAW is needed to support USB UPSes"
|
||||
ERROR_I2C_CHARDEV="USB_HIDDEV is needed to support USB UPSes"
|
||||
fi
|
||||
if use serial; then
|
||||
CONFIG_CHECK="~SERIAL_8250"
|
||||
ERROR_SERIAL_8250="SERIAL_8250 is needed to support Serial UPSes"
|
||||
fi
|
||||
|
||||
# Now do the actual checks setup above
|
||||
check_extra_config
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
if [[ ${PV} == *9999 ]] ; then
|
||||
./autogen.sh || die
|
||||
fi
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local myeconfargs=(
|
||||
--datadir=/usr/share/nut
|
||||
--datarootdir=/usr/share/nut
|
||||
--disable-static
|
||||
--disable-strip
|
||||
--disable-Werror
|
||||
--sysconfdir=/etc/nut
|
||||
--with-dev
|
||||
--with-drvpath="/$(get_libdir)/nut"
|
||||
--with-group=nut
|
||||
--with-htmlpath=/usr/share/nut/html
|
||||
--with-logfacility=LOG_DAEMON
|
||||
--with-statepath=/var/lib/nut
|
||||
--with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
|
||||
--with-systemdtmpfilesdir="/usr/lib/tmpfiles.d"
|
||||
--with-udev-dir="$(get_udevdir)"
|
||||
--with-user=nut
|
||||
--without-powerman
|
||||
--without-python
|
||||
--without-python2
|
||||
--without-python3
|
||||
--with-altpidpath=/run/nut
|
||||
--with-pidpath=/run/nut
|
||||
$(use_enable test cppunit)
|
||||
$(use_with cgi)
|
||||
$(use_with i2c linux_i2c)
|
||||
$(use_with ipmi freeipmi)
|
||||
$(use_with ipmi)
|
||||
$(use_with serial)
|
||||
$(use_with snmp)
|
||||
$(use_with ssl)
|
||||
$(use_with tcpd wrap)
|
||||
$(use_with usb)
|
||||
$(use_with xml neon)
|
||||
$(use_with zeroconf avahi)
|
||||
)
|
||||
|
||||
filter-lto
|
||||
append-flags -fno-lto
|
||||
tc-export CC CXX AR
|
||||
|
||||
use cgi && myeconfargs+=( --with-cgipath=/usr/share/nut/cgi )
|
||||
use man && myeconfargs+=( --with-doc=man )
|
||||
|
||||
export bashcompdir="$(get_bashcompdir)"
|
||||
|
||||
econf "${myeconfargs[@]}"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
default
|
||||
|
||||
rm -rf "${ED}/etc/hotplug" || die
|
||||
|
||||
find "${ED}" -name '*.la' -delete || die
|
||||
|
||||
dodir /sbin
|
||||
use split-usr && dosym ../usr/sbin/upsdrvctl /sbin/upsdrvctl
|
||||
|
||||
if use cgi; then
|
||||
elog "CGI monitoring scripts are installed in ${EPREFIX}/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."
|
||||
elog
|
||||
elog "Use script aliases according to the web server you use (apache, nginx, lighttpd, etc...)"
|
||||
fi
|
||||
|
||||
# This must be done after all of the install phases
|
||||
local i
|
||||
for i in "${ED}"/etc/nut/*.sample ; do
|
||||
mv "${i}" "${i/.sample/}" || die
|
||||
done
|
||||
|
||||
local DOCS=( AUTHORS MAINTAINERS NEWS README TODO UPGRADING )
|
||||
einstalldocs
|
||||
|
||||
if use doc; then
|
||||
newdoc lib/README README.lib
|
||||
dodoc docs/*.txt
|
||||
docinto cables
|
||||
dodoc docs/cables/*
|
||||
fi
|
||||
|
||||
newinitd "${FILESDIR}"/nut-2.8.0-init.d-upsd upsd
|
||||
newinitd "${FILESDIR}"/nut-2.2.2-init.d-upsdrv upsdrv
|
||||
newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsmon upsmon
|
||||
newinitd "${FILESDIR}"/nut-2.6.5-init.d-upslog upslog
|
||||
newinitd "${FILESDIR}"/nut.powerfail.initd nut.powerfail
|
||||
|
||||
newbashcomp "${S}"/scripts/misc/nut.bash_completion upsc
|
||||
bashcomp_alias upsc upscmd upsd upsdrvctl upsmon upsrw
|
||||
|
||||
if use zeroconf; then
|
||||
insinto /etc/avahi/services
|
||||
doins scripts/avahi/nut.service
|
||||
fi
|
||||
|
||||
mv "${ED}"/usr/lib/tmpfiles.d/nut-common.tmpfiles "${ED}"/usr/lib/tmpfiles.d/nut-common-tmpfiles.conf || die
|
||||
|
||||
# Fix double directory
|
||||
sed -i -e 's:/nut/nut:/nut:g' "${ED}"/usr/lib/tmpfiles.d/nut-common-tmpfiles.conf || die
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
elog "Please note that NUT now runs under the 'nut' user."
|
||||
elog "NUT is in the uucp group for access to RS-232 UPS."
|
||||
elog "However if you use a USB UPS you may need to look at the udev or"
|
||||
elog "hotplug rules that are installed, and alter them suitably."
|
||||
elog
|
||||
elog "You are strongly advised to read the UPGRADING file provided by upstream."
|
||||
elog
|
||||
elog "Please note that upsdrv is NOT automatically started by upsd anymore."
|
||||
elog "If you have multiple UPS units, you can use their NUT names to"
|
||||
elog "have a service per UPS:"
|
||||
elog "ln -s /etc/init.d/upsdrv /etc/init.d/upsdrv.\$UPSNAME"
|
||||
elog
|
||||
elog 'If you want apcupsd to power off your UPS when it'
|
||||
elog 'shuts down your system in a power failure, you must'
|
||||
elog 'add nut.powerfail to your shutdown runlevel:'
|
||||
elog
|
||||
elog 'rc-update add nut.powerfail shutdown'
|
||||
elog
|
||||
|
||||
optfeature "all notify events generate a global message (wall) to all users, plus they are logged via the syslog" \
|
||||
sys-apps/util-linux[logger,tty-helpers]
|
||||
|
||||
udev_reload
|
||||
|
||||
tmpfiles_process nut-common-tmpfiles.conf
|
||||
}
|
||||
|
||||
pkg_postrm() {
|
||||
udev_reload
|
||||
}
|
||||
Reference in New Issue
Block a user