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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Sat Mar 7 20:25:38 2009 UTC (10 years, 10 months ago) by betelgeuse
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
FILE REMOVED
Remove old versions.
(Portage version: 2.2_rc20/cvs/Linux 2.6.29-rc6 i686)

1 # Copyright 1999-2008 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.2.1.ebuild,v 1.2 2008/06/25 01:19:47 robbat2 Exp $
4
5 inherit eutils fixheadtails autotools
6
7 MY_P="${P/_/-}"
8
9 DESCRIPTION="Network-UPS Tools"
10 HOMEPAGE="http://www.networkupstools.org/"
11 # Nut mirrors are presently broken
12 SRC_URI="http://www.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
13
14 S="${WORKDIR}/${MY_P}"
15
16 LICENSE="GPL-2"
17 SLOT="0"
18 KEYWORDS="~alpha ~amd64 ~ppc ~sparc ~x86 ~x86-fbsd"
19 IUSE="cgi snmp usb ssl hal"
20
21 RDEPEND="cgi? ( >=media-libs/gd-2 )
22 snmp? ( net-analyzer/net-snmp )
23 usb? ( >=dev-libs/libusb-0.1.12 )
24 hal? ( >=sys-apps/hal-0.5.9.1 )
25 ssl? ( dev-libs/openssl )
26 >=sys-fs/udev-114"
27 DEPEND="$RDEPEND
28 >=sys-apps/sed-4
29 >=sys-devel/autoconf-2.58"
30
31 # public files should be 644 root:root
32 NUT_PUBLIC_FILES="/etc/nut/{{hosts,upsset,ups,upssched}.conf,upsstats{,-single}.html}"
33 # private files should be 640 root:nut - readable by nut, writeable by root,
34 NUT_PRIVATE_FILES="/etc/nut/{upsd.conf,upsd.users,upsmon.conf}"
35
36 pkg_setup() {
37 if use cgi && ! built_with_use media-libs/gd png ; then
38 eerror "CGI support requested, bug GD not built with PNG support"
39 eerror "Please rebuild gd with 'USE=png'"
40 die
41 fi
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_unpack() {
54 unpack ${A}
55
56 cd "${S}"
57
58 sed -e "s/install: install-dirs/install: install-dirs install-conf/" \
59 -i Makefile.in || die "sed failed"
60
61 ht_fix_file configure.in
62
63 sed -e "s:GD_LIBS.*=.*-L/usr/X11R6/lib \(.*\) -lXpm -lX11:GD_LIBS=\"\1:" \
64 -i configure.in || die "sed failed"
65
66 ebegin "Recreating configure"
67 WANT_AUTOCONF=2.5 eautoconf || die "autoconf failed"
68 eend $?
69
70 sed -e "s:52_nut-usbups.rules:70-nut-usbups.rules:" \
71 -i scripts/udev/Makefile.in || die "sed failed"
72 }
73
74 src_compile() {
75 local myconf
76
77 if [ -n "${NUT_DRIVERS}" ]; then
78 myconf="${myconf} --with-drivers=${NUT_DRIVERS// /,}"
79 fi
80
81 econf \
82 --with-user=nut \
83 --with-group=nut \
84 --with-drvpath=/lib/nut \
85 --sysconfdir=/etc/nut \
86 --with-logfacility=LOG_DAEMON \
87 --with-statepath=/var/lib/nut \
88 --with-htmlpath=/usr/share/nut/html \
89 --datarootdir=/usr/share/nut \
90 --datadir=/usr/share/nut \
91 --with-lib \
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 emake || die "compile problem"
101
102 }
103
104 src_install() {
105
106 make DESTDIR="${D}" install || die "make install failed"
107
108 dodir /sbin
109 dosym /lib/nut/upsdrvctl /sbin/upsdrvctl
110 # This needs to exist for the scripts
111 dosym /lib/nut/upsdrvctl /usr/sbin/upsdrvctl
112
113 if use cgi; then
114 elog "CGI monitoring scripts are installed in /usr/share/nut/cgi."
115 elog "copy them to your web server's ScriptPath to activate (this is a"
116 elog "change from the old location)."
117 elog "If you use lighttpd, see lighttpd_nut.conf in the documentation."
118 fi
119
120 # this must be done after all of the install phases
121 for i in "${D}"/etc/nut/*.sample ; do
122 mv "${i}" "${i/.sample/}"
123 done
124
125 dodoc ChangeLog INSTALL MAINTAINERS NEWS README UPGRADING \
126 docs/{FAQ,*.txt}
127
128 newdoc lib/README README.lib
129
130 newdoc "${FILESDIR}"/lighttpd_nut.conf-2.2.0 lighttpd_nut.conf
131
132 docinto cables
133 dodoc docs/cables/*
134
135 newinitd "${FILESDIR}"/upsd.rc6 upsd
136 newinitd "${FILESDIR}"/upsdrv.rc6-r1 upsdrv
137 newinitd "${FILESDIR}"/upsmon.rc6 upsmon
138
139 # This sets up permissions for nut to access a UPS
140 insinto /etc/udev/rules.d/
141 newins scripts/udev/nut-usbups.rules 70-nut-usbups.rules
142
143 keepdir /var/lib/nut
144
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 # this is installed for 2.4 and fbsd guys
157 if ! has_version sys-fs/udev; then
158 insinto /etc/hotplug/usb
159 insopts -m 755
160 doins scripts/hotplug/nut-usbups.hotplug
161 fi
162
163 if use hal; then
164 insinto /usr/share/hal/fdi/information/20thirdparty/
165 doins scripts/hal/20-ups-nut-device.fdi
166 insinto /usr/libexec
167 insopts -m 755
168 doins drivers/hald-addon-*
169 rm "${D}"/lib/nut/hald-addon-*
170 fi
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 warningmsg elog
189 }
190
191 warningmsg() {
192 msgfunc="$1"
193 [ -z "$msgfunc" ] && die "msgfunc not specified in call to warningmsg!"
194 ${msgfunc} "Please note that NUT now runs under the 'nut' user."
195 ${msgfunc} "NUT is in the uucp group for access to RS-232 UPS."
196 ${msgfunc} "However if you use a USB UPS you may need to look at the udev or"
197 ${msgfunc} "hotplug rules that are installed, and alter them suitably."
198 echo
199 ${msgfunc} "If you use hald, you may be able to skip the normal init scripts."
200 echo
201 ${msgfunc} "You are strongly advised to read the UPGRADING file provided by upstream."
202 }

  ViewVC Help
Powered by ViewVC 1.1.20