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

Contents of /sys-power/nut/nut-2.4.3-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Wed Apr 27 19:07:05 2011 UTC (8 years, 9 months ago) by ssuominen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +1 -1 lines
FILE REMOVED
old, punt desc for USE hal

(Portage version: 2.2.0_alpha30/cvs/Linux x86_64)

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

  ViewVC Help
Powered by ViewVC 1.1.20