/[gentoo-x86]/sys-power/nut/nut-2.6.5-r1.ebuild
Gentoo

Contents of /sys-power/nut/nut-2.6.5-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Sun Nov 2 10:18:14 2014 UTC (5 years, 3 months ago) by swift
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +6 -4 lines
Remove sec-policy/selinux-* dependency from DEPEND but keep in RDEPEND (bug #527698)

(Portage version: 2.2.8-r2/cvs/Linux x86_64, signed Manifest commit with key 0x2EDD52403B68AF47)

1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-power/nut/nut-2.6.5-r1.ebuild,v 1.6 2014/06/29 08:28:45 swift Exp $
4
5 EAPI=5
6 inherit autotools bash-completion-r1 eutils fixheadtails multilib user systemd
7
8 MY_P=${P/_/-}
9
10 DESCRIPTION="Network-UPS Tools"
11 HOMEPAGE="http://www.networkupstools.org/"
12 # Nut mirrors are presently broken
13 SRC_URI="http://random.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz
14 http://www.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
15
16 LICENSE="GPL-2"
17 SLOT="0"
18 KEYWORDS="amd64 ~arm ppc ppc64 x86 ~x86-fbsd"
19 IUSE="avahi cgi ipmi snmp usb selinux ssl tcpd xml"
20
21 CDEPEND="avahi? ( net-dns/avahi )
22 cgi? ( >=media-libs/gd-2[png] )
23 snmp? ( net-analyzer/net-snmp )
24 usb? ( virtual/libusb:0 )
25 ssl? ( >=dev-libs/openssl-1 )
26 tcpd? ( sys-apps/tcp-wrappers )
27 xml? ( >=net-libs/neon-0.25.0 )
28 ipmi? ( sys-libs/freeipmi )
29 virtual/udev"
30 DEPEND="$CDEPEND
31 >=sys-apps/sed-4
32 virtual/pkgconfig"
33 RDEPEND="${CDEPEND}
34 selinux? ( sec-policy/selinux-nut )
35 "
36
37 S=${WORKDIR}/${MY_P}
38
39 # public files should be 644 root:root
40 NUT_PUBLIC_FILES="/etc/nut/{ups,upssched}.conf"
41 # private files should be 640 root:nut - readable by nut, writeable by root,
42 NUT_PRIVATE_FILES="/etc/nut/{upsd.conf,upsd.users,upsmon.conf}"
43 # public files should be 644 root:root, only installed if USE=cgi
44 NUT_CGI_FILES="/etc/nut/{{hosts,upsset}.conf,upsstats{,-single}.html}"
45
46 pkg_setup() {
47 enewgroup nut 84
48 enewuser nut 84 -1 /var/lib/nut nut,uucp
49 # As of udev-104, NUT must be in uucp and NOT in tty.
50 gpasswd -d nut tty 2>/dev/null
51 gpasswd -a nut uucp 2>/dev/null
52 # in some cases on old systems it wasn't in the nut group either!
53 gpasswd -a nut nut 2>/dev/null
54 warningmsg ewarn
55 }
56
57 src_prepare() {
58 ht_fix_file configure.in
59
60 epatch "${FILESDIR}"/${PN}-2.4.1-no-libdummy.patch
61 epatch "${FILESDIR}"/${PN}-2.6.2-lowspeed-buffer-size.patch
62 #epatch "${FILESDIR}"/${PN}-2.6.3-CVE-2012-2944.patch
63 epatch "${FILESDIR}"/${PN}-2.6.5-freeipmi_fru.patch
64
65 sed -e "s:GD_LIBS.*=.*-L/usr/X11R6/lib \(.*\) -lXpm -lX11:GD_LIBS=\"\1:" \
66 -e '/systemdsystemunitdir=.*echo.*sed.*libdir/s,^,#,g' \
67 -i configure.in || die
68
69 sed -e "s:52.nut-usbups.rules:70-nut-usbups.rules:" \
70 -i scripts/udev/Makefile.am || die
71
72 rm -f ltmain.sh m4/lt* m4/libtool.m4
73
74 sed -i \
75 -e 's:@LIBSSL_LDFLAGS@:@LIBSSL_LIBS@:' \
76 lib/libupsclient{.pc,-config}.in || die #361685
77
78 eautoreconf
79 }
80
81 src_configure() {
82 local myconf
83
84 if [ -n "${NUT_DRIVERS}" ]; then
85 myconf="${myconf} --with-drivers=${NUT_DRIVERS// /,}"
86 fi
87
88 use cgi && myconf="${myconf} --with-cgipath=/usr/share/nut/cgi"
89
90 # TODO: USE flag for sys-power/powerman
91 econf \
92 --sysconfdir=/etc/nut \
93 --datarootdir=/usr/share/nut \
94 --datadir=/usr/share/nut \
95 --disable-static \
96 --with-statepath=/var/lib/nut \
97 --with-drvpath=/$(get_libdir)/nut \
98 --with-htmlpath=/usr/share/nut/html \
99 --with-user=nut \
100 --with-group=nut \
101 --with-logfacility=LOG_DAEMON \
102 --with-dev \
103 --with-serial \
104 --without-hal \
105 --without-powerman \
106 $(use_with avahi) \
107 $(use_with cgi) \
108 $(use_with ipmi) \
109 $(use_with ipmi freeipmi) \
110 $(use_with snmp) \
111 $(use_with ssl) \
112 $(use_with tcpd wrap) \
113 $(use_with usb) \
114 $(use_with xml neon) \
115 $(systemd_with_unitdir) \
116 ${myconf}
117 }
118
119 src_install() {
120 emake DESTDIR="${D}" install || die
121
122 find "${D}" -name '*.la' -exec rm -f {} +
123
124 dodir /sbin
125 dosym /$(get_libdir)/nut/upsdrvctl /sbin/upsdrvctl
126 # This needs to exist for the scripts
127 dosym /$(get_libdir)/nut/upsdrvctl /usr/sbin/upsdrvctl
128
129 if use cgi; then
130 elog "CGI monitoring scripts are installed in /usr/share/nut/cgi."
131 elog "copy them to your web server's ScriptPath to activate (this is a"
132 elog "change from the old location)."
133 elog "If you use lighttpd, see lighttpd_nut.conf in the documentation."
134 fi
135
136 # this must be done after all of the install phases
137 for i in "${D}"/etc/nut/*.sample ; do
138 mv "${i}" "${i/.sample/}"
139 done
140
141 dodoc AUTHORS ChangeLog docs/*.txt MAINTAINERS NEWS README TODO UPGRADING || die
142
143 newdoc lib/README README.lib || die
144 newdoc "${FILESDIR}"/lighttpd_nut.conf-2.2.0 lighttpd_nut.conf || die
145
146 docinto cables
147 dodoc docs/cables/* || die
148
149 newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsd upsd || die
150 newinitd "${FILESDIR}"/nut-2.2.2-init.d-upsdrv upsdrv || die
151 newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsmon upsmon || die
152 newinitd "${FILESDIR}"/nut-2.6.5-init.d-upslog upslog || die
153 newinitd "${FILESDIR}"/nut.powerfail.initd nut.powerfail || die
154
155 keepdir /var/lib/nut
156
157 einfo "Setting up permissions on files and directories"
158 fperms 0700 /var/lib/nut
159 fowners nut:nut /var/lib/nut
160
161 # Do not remove eval here, because the variables contain shell expansions.
162 eval fperms 0640 ${NUT_PRIVATE_FILES}
163 eval fowners root:nut ${NUT_PRIVATE_FILES}
164
165 # Do not remove eval here, because the variables contain shell expansions.
166 eval fperms 0644 ${NUT_PUBLIC_FILES}
167 eval fowners root:root ${NUT_PUBLIC_FILES}
168
169 # Do not remove eval here, because the variables contain shell expansions.
170 if use cgi; then
171 eval fperms 0644 ${NUT_CGI_FILES}
172 eval fowners root:root ${NUT_CGI_FILES}
173 fi
174
175 # this is installed for 2.4 and fbsd guys
176 if ! has_version virtual/udev; then
177 einfo "Installing non-udev hotplug support"
178 insinto /etc/hotplug/usb
179 insopts -m 755
180 doins scripts/hotplug/nut-usbups.hotplug
181 fi
182
183 dobashcomp "${S}"/scripts/misc/nut.bash_completion
184 }
185
186 pkg_postinst() {
187 # this is to ensure that everybody that installed old versions still has
188 # correct permissions
189
190 chown nut:nut "${ROOT}"/var/lib/nut 2>/dev/null
191 chmod 0700 "${ROOT}"/var/lib/nut 2>/dev/null
192
193 # Do not remove eval here, because the variables contain shell expansions.
194 eval chown root:nut "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
195 eval chmod 0640 "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
196
197 # Do not remove eval here, because the variables contain shell expansions.
198 eval chown root:root "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
199 eval chmod 0644 "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
200
201 # Do not remove eval here, because the variables contain shell expansions.
202 if use cgi; then
203 eval chown root:root "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
204 eval chmod 0644 "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
205 fi
206
207 warningmsg elog
208 }
209
210 warningmsg() {
211 msgfunc="$1"
212 [ -z "$msgfunc" ] && die "msgfunc not specified in call to warningmsg!"
213 ${msgfunc} "Please note that NUT now runs under the 'nut' user."
214 ${msgfunc} "NUT is in the uucp group for access to RS-232 UPS."
215 ${msgfunc} "However if you use a USB UPS you may need to look at the udev or"
216 ${msgfunc} "hotplug rules that are installed, and alter them suitably."
217 ${msgfunc} ''
218 ${msgfunc} "You are strongly advised to read the UPGRADING file provided by upstream."
219 ${msgfunc} ''
220 ${msgfunc} "Please note that upsdrv is NOT automatically started by upsd anymore."
221 ${msgfunc} "If you have multiple UPS units, you can use their NUT names to"
222 ${msgfunc} "have a service per UPS:"
223 ${msgfunc} "ln -s /etc/init.d/upsdrv /etc/init.d/upsdrv.\$UPSNAME"
224 ${msgfunc} ''
225 ${msgfunc} 'If you want apcupsd to power off your UPS when it'
226 ${msgfunc} 'shuts down your system in a power failure, you must'
227 ${msgfunc} 'add nut.powerfail to your shutdown runlevel:'
228 ${msgfunc} ''
229 ${msgfunc} 'rc-update add nut.powerfail shutdown'
230 ${msgfunc} ''
231
232 }

  ViewVC Help
Powered by ViewVC 1.1.20