/[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.9 - (hide annotations) (download)
Sun Mar 13 20:30:13 2011 UTC (9 years ago) by ssuominen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.8: +1 -1 lines
FILE REMOVED
old

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

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

  ViewVC Help
Powered by ViewVC 1.1.20