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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Sat Aug 29 18:34:38 2009 UTC (10 years, 7 months ago) by nixnut
Branch: MAIN
Changes since 1.3: +2 -2 lines
ppc stable #280368
(Portage version: 2.1.6.13/cvs/Linux ppc)

1 # Copyright 1999-2009 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.1-r1.ebuild,v 1.3 2009/08/05 15:39:17 chainsaw 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
16 S="${WORKDIR}/${MY_P}"
17
18 LICENSE="GPL-2"
19 SLOT="0"
20 KEYWORDS="~alpha amd64 ppc ~sparc ~x86 ~x86-fbsd"
21 IUSE="cgi snmp usb ssl hal xml"
22
23 RDEPEND="cgi? ( >=media-libs/gd-2[png] )
24 snmp? ( net-analyzer/net-snmp )
25 usb? ( =virtual/libusb-0* )
26 hal? ( >=sys-apps/hal-0.5.11 )
27 ssl? ( dev-libs/openssl )
28 xml? ( >=net-misc/neon-0.25.0 )
29 >=sys-fs/udev-114"
30 DEPEND="$RDEPEND
31 >=sys-apps/sed-4
32 >=sys-devel/autoconf-2.58"
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 use hal && gpasswd -a haldaemon nut 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
58 sed -e "s:GD_LIBS.*=.*-L/usr/X11R6/lib \(.*\) -lXpm -lX11:GD_LIBS=\"\1:" \
59 -i configure.in || die "sed failed"
60
61 sed -e "s:52.nut-usbups.rules:70-nut-usbups.rules:" \
62 -i scripts/udev/Makefile.am || die "sed failed"
63
64 rm -f ltmain.sh m4/lt* m4/libtool.m4
65
66 WANT_AUTOCONF=2.5 eautoreconf || die "autoconf failed"
67 }
68
69 src_configure() {
70 local myconf
71
72 if [ -n "${NUT_DRIVERS}" ]; then
73 myconf="${myconf} --with-drivers=${NUT_DRIVERS// /,}"
74 fi
75
76 econf \
77 --with-user=nut \
78 --with-group=nut \
79 --with-drvpath=/lib/nut \
80 --sysconfdir=/etc/nut \
81 --with-logfacility=LOG_DAEMON \
82 --with-statepath=/var/lib/nut \
83 --with-htmlpath=/usr/share/nut/html \
84 --datarootdir=/usr/share/nut \
85 --datadir=/usr/share/nut \
86 --with-dev \
87 $(use_with xml neonxml) \
88 $(use_with hal) \
89 $(use_with ssl) \
90 $(use_with usb) \
91 $(use_with snmp) \
92 $(use_with cgi) \
93 $(use_with cgi cgipath /usr/share/nut/cgi) \
94 ${myconf} || die "econf failed"
95
96 }
97
98 src_install() {
99
100 emake DESTDIR="${D}" install || die "make install failed"
101
102 dodir /sbin
103 dosym /lib/nut/upsdrvctl /sbin/upsdrvctl
104 # This needs to exist for the scripts
105 dosym /lib/nut/upsdrvctl /usr/sbin/upsdrvctl
106
107 if use cgi; then
108 elog "CGI monitoring scripts are installed in /usr/share/nut/cgi."
109 elog "copy them to your web server's ScriptPath to activate (this is a"
110 elog "change from the old location)."
111 elog "If you use lighttpd, see lighttpd_nut.conf in the documentation."
112 fi
113
114 # this must be done after all of the install phases
115 for i in "${D}"/etc/nut/*.sample ; do
116 mv "${i}" "${i/.sample/}"
117 done
118
119 dodoc ChangeLog INSTALL MAINTAINERS NEWS README UPGRADING \
120 docs/{FAQ,*.txt} || die
121
122 newdoc lib/README README.lib || die
123
124 newdoc "${FILESDIR}"/lighttpd_nut.conf-2.2.0 lighttpd_nut.conf || die
125
126 docinto cables
127 dodoc docs/cables/* || die
128
129 newinitd "${FILESDIR}"/nut-2.2.2-init.d-upsd upsd
130 newinitd "${FILESDIR}"/nut-2.2.2-init.d-upsdrv upsdrv
131 newinitd "${FILESDIR}"/nut-2.2.2-init.d-upsmon upsmon
132
133 # This sets up permissions for nut to access a UPS
134 insinto /etc/udev/rules.d/
135 newins scripts/udev/nut-usbups.rules 70-nut-usbups.rules
136
137 keepdir /var/lib/nut
138
139 einfo "Setting up permissions on files and directories"
140 fperms 0700 /var/lib/nut
141 fowners nut:nut /var/lib/nut
142
143 # Do not remove eval here, because the variables contain shell expansions.
144 eval fperms 0640 ${NUT_PRIVATE_FILES}
145 eval fowners root:nut ${NUT_PRIVATE_FILES}
146
147 # Do not remove eval here, because the variables contain shell expansions.
148 eval fperms 0644 ${NUT_PUBLIC_FILES}
149 eval fowners root:root ${NUT_PUBLIC_FILES}
150
151 # Do not remove eval here, because the variables contain shell expansions.
152 if use cgi; then
153 eval fperms 0644 ${NUT_CGI_FILES}
154 eval fowners root:root ${NUT_CGI_FILES}
155 fi
156
157 # this is installed for 2.4 and fbsd guys
158 if ! has_version sys-fs/udev; then
159 einfo "Installing non-udev hotplug support"
160 insinto /etc/hotplug/usb
161 insopts -m 755
162 doins scripts/hotplug/nut-usbups.hotplug
163 fi
164
165 if use hal; then
166 einfo "Installing HAL support"
167 insinto /usr/share/hal/fdi/information/20thirdparty/
168 doins scripts/hal/20-ups-nut-device.fdi
169 insinto /usr/libexec
170 insopts -m 755
171 doins drivers/hald-addon-*
172 rm "${D}"/lib/nut/hald-addon-*
173 fi
174
175 dobashcompletion "${S}"/scripts/misc/nut.bash_completion
176 }
177
178 pkg_postinst() {
179 # this is to ensure that everybody that installed old versions still has
180 # correct permissions
181
182 chown nut:nut "${ROOT}"/var/lib/nut 2>/dev/null
183 chmod 0700 "${ROOT}"/var/lib/nut 2>/dev/null
184
185 # Do not remove eval here, because the variables contain shell expansions.
186 eval chown root:nut "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
187 eval chmod 0640 "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
188
189 # Do not remove eval here, because the variables contain shell expansions.
190 eval chown root:root "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
191 eval chmod 0644 "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
192
193 # Do not remove eval here, because the variables contain shell expansions.
194 if use cgi; then
195 eval chown root:root "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
196 eval chmod 0644 "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
197 fi
198
199 warningmsg elog
200 }
201
202 warningmsg() {
203 msgfunc="$1"
204 [ -z "$msgfunc" ] && die "msgfunc not specified in call to warningmsg!"
205 ${msgfunc} "Please note that NUT now runs under the 'nut' user."
206 ${msgfunc} "NUT is in the uucp group for access to RS-232 UPS."
207 ${msgfunc} "However if you use a USB UPS you may need to look at the udev or"
208 ${msgfunc} "hotplug rules that are installed, and alter them suitably."
209 echo
210 ${msgfunc} "If you use hald, you may be able to skip the normal init scripts."
211 echo
212 ${msgfunc} "You are strongly advised to read the UPGRADING file provided by upstream."
213 echo
214 ${msgfunc} "Please note that upsdrv is NOT automatically started by upsd anymore."
215 ${msgfunc} "If you have multiple UPS units, you can use their NUT names to"
216 ${msgfunc} "have a service per UPS:"
217 ${msgfunc} "ln -s /etc/init.d/upsdrv /etc/init.d/upsdrv.\$UPSNAME"
218 }

  ViewVC Help
Powered by ViewVC 1.1.20