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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Fri Jan 2 22:51:10 2015 UTC (5 years ago) by mgorny
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +1 -1 lines
FILE REMOVED
Remove old (bash-completion.eclass cleanup).

(Portage version: 2.2.15/cvs/Linux x86_64, signed Manifest commit with key EFB4464E!)

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

  ViewVC Help
Powered by ViewVC 1.1.20