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

Contents of /sys-power/nut/nut-2.6.2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Sat Jun 9 19:08:02 2012 UTC (2 years, 1 month ago) by armin76
Branch: MAIN
Changes since 1.3: +2 -2 lines
Drop alpha/sparc keywords

(Portage version: 2.1.10.53/cvs/Linux ia64)

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

  ViewVC Help
Powered by ViewVC 1.1.20