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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Tue Oct 9 00:45:34 2007 UTC (12 years, 4 months ago) by robbat2
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +1 -1 lines
FILE REMOVED
Clean up old ebuilds and fix quoting in present latest version.
(Portage version: 2.1.3.12)

1 # Copyright 1999-2007 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.0.4.ebuild,v 1.4 2007/07/15 07:08:11 mr_bones_ Exp $
4
5 inherit eutils fixheadtails
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="mirror://nut/source/${PV%.*}/${MY_P}.tar.gz"
13 SRC_URI="http://www.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
14
15 S="${WORKDIR}/${MY_P}"
16
17 LICENSE="GPL-2"
18 SLOT="0"
19 KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
20 IUSE="cgi snmp usb ssl"
21
22 RDEPEND="cgi? ( >=media-libs/gd-2 )
23 snmp? ( net-analyzer/net-snmp )
24 usb? ( dev-libs/libusb )
25 ssl? ( dev-libs/openssl )"
26 DEPEND="$RDEPEND
27 >=sys-apps/sed-4
28 >=sys-devel/autoconf-2.58"
29
30 # public files should be 644 root:root
31 NUT_PUBLIC_FILES="/etc/nut/{{hosts,upsset,ups,upssched}.conf,upsstats{,-single}.html}"
32 # private files should be 640 root:nut - readable by nut, writeable by root,
33 NUT_PRIVATE_FILES="/etc/nut/{upsd.conf,upsd.users,upsmon.conf}"
34
35 pkg_setup() {
36 enewgroup nut 84
37 enewuser nut 84 -1 /var/state/nut nut,tty
38 warningmsg
39 }
40
41 src_unpack() {
42 unpack ${A}
43
44 epatch ${FILESDIR}/upsstats-upsset-link-${PV}.patch
45
46 cd "${S}"
47
48 sed -e "s/install: install-dirs/install: install-dirs install-conf/" \
49 -i Makefile.in || die "sed failed"
50
51 ht_fix_file configure.in
52
53 sed -e "s:GD_LIBS.*=.*-L/usr/X11R6/lib \(.*\) -lXpm -lX11:GD_LIBS=\"\1:" \
54 -i configure.in || die "sed failed"
55
56 ebegin "Recreating configure"
57 WANT_AUTOCONF=2.5 autoconf || die "autoconf failed"
58 eend $?
59 }
60
61 src_compile() {
62 local myconf
63
64 if [ -n "${NUT_DRIVERS}" ]; then
65 myconf="${myconf} --with-drivers=${NUT_DRIVERS// /,}"
66 fi
67
68 econf \
69 --with-user=nut \
70 --with-group=nut \
71 --with-drvpath=/lib/nut \
72 --sysconfdir=/etc/nut \
73 --with-logfacility=LOG_DAEMON \
74 --with-statepath=/var/lib/nut \
75 $(use_with ssl) \
76 $(use_with cgi) \
77 $(use_with cgi cgipath /usr/share/nut) \
78 ${myconf} || die "econf failed"
79
80 emake || die "compile problem"
81
82 if use snmp; then
83 emake snmp || die "snmp compile problem"
84 fi
85
86 if use usb; then
87 emake usb || die "usb compile problem"
88 fi
89
90 if use cgi; then
91 emake cgi || die "cgi compile problem"
92 fi
93 }
94
95 src_install() {
96 make DESTDIR="${D}" install install-lib || die "make install failed"
97
98 dodir /sbin
99 dosym /lib/nut/upsdrvctl /sbin/upsdrvctl
100 # This needs to exist for the scripts
101 dosym /lib/nut/upsdrvctl /usr/sbin/upsdrvctl
102
103 if use snmp; then
104 make DESTDIR="${D}" install-snmp || die "make install-snmp failed"
105 fi
106
107 if use usb; then
108 make DESTDIR="${D}" install-usb || die "make install-usb failed"
109 fi
110
111 if use cgi; then
112 make DESTDIR="${D}" install-cgi || die "make install-cgi failed"
113 make DESTDIR="${D}" install-cgi-conf || die "make install-cgi-conf failed"
114 einfo "CGI monitoring scripts are installed in /usr/share/nut."
115 einfo "copy them to your web server's ScriptPath to activate."
116 einfo "If you use lighttpd, see lighttpd_nut.conf in the documentation."
117 fi
118
119 # this must be done after all of the install phases
120 for i in "${D}"/etc/nut/*.sample ; do
121 mv "${i}" "${i/.sample/}"
122 done
123
124 dodoc CHANGES CREDITS INSTALL MAINTAINERS NEWS README UPGRADING \
125 docs/{FAQ,*.txt}
126
127 newdoc lib/README README.lib
128
129 dodoc ${FILESDIR}/lighttpd_nut.conf
130
131 docinto cables
132 dodoc docs/cables/*
133
134 newinitd "${FILESDIR}/upsd.rc6" upsd
135 newinitd "${FILESDIR}/upsdrv.rc6-r1" upsdrv
136 newinitd "${FILESDIR}/upsmon.rc6" upsmon
137
138 # This sets up permissions for nut to access a UPS
139 insinto /etc/udev/rules.d/
140 newins scripts/hotplug-ng/nut-usbups.rules 70-nut-usbups.rules
141
142 keepdir /var/lib/nut
143
144 fperms 0700 /var/lib/nut
145 fowners nut:nut /var/lib/nut
146
147 eval fperms 0640 ${NUT_PRIVATE_FILES}
148 eval fowners root:nut ${NUT_PRIVATE_FILES}
149
150 eval fperms 0644 ${NUT_PUBLIC_FILES}
151 eval fowners root:root ${NUT_PUBLIC_FILES}
152
153 # this is installed for 2.4 and fbsd guys
154 if ! has_version sys-fs/udev; then
155 insinto /etc/hotplug/usb
156 insopts -m 755
157 doins scripts/hotplug-ng/nut-usbups.hotplug
158 fi
159 }
160
161 pkg_postinst() {
162 # this is to ensure that everybody that installed old versions still has
163 # correct permissions
164 chown nut:nut ${ROOT}/var/lib/nut 2>/dev/null
165 chmod 0700 ${ROOT}/var/lib/nut 2>/dev/null
166
167 eval chown root:nut ${ROOT}${NUT_PRIVATE_FILES} 2>/dev/null
168 eval chmod 0640 ${ROOT}${NUT_PRIVATE_FILES} 2>/dev/null
169
170 eval chown root:root ${ROOT}${NUT_PUBLIC_FILES} 2>/dev/null
171 eval chmod 0644 ${ROOT}${NUT_PUBLIC_FILES} 2>/dev/null
172
173 warningmsg
174 }
175
176 warningmsg() {
177 ewarn "Please note that NUT now runs under the 'nut' user."
178 ewarn "NUT is in the tty group for access to RS-232 UPS."
179 ewarn "However if you use a USB UPS you may need to look at the udev or"
180 ewarn "hotplug rules that are installed."
181 }

  ViewVC Help
Powered by ViewVC 1.1.20