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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Tue Oct 9 00:45:35 2007 UTC (12 years, 4 months ago) by robbat2
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +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.5-r1.ebuild,v 1.9 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-0.1.12 )
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 # try to add nut to the tty group for old cases where it already existed
39 gpasswd -a nut tty
40 # in some cases it wasn't in the nut group either!
41 gpasswd -a nut nut
42 warningmsg
43 }
44
45 src_unpack() {
46 unpack ${A}
47
48 EPATCH_OPTS="-p1 -d ${S}" epatch ${FILESDIR}/upsstats-upsset-link-2.0.5.patch
49 EPATCH_OPTS="-p1 -d ${S}" epatch ${FILESDIR}/nut-2.0.5-bcmxcp-3phase.patch
50
51 cd "${S}"
52
53 sed -e "s/install: install-dirs/install: install-dirs install-conf/" \
54 -i Makefile.in || die "sed failed"
55
56 ht_fix_file configure.in
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 ebegin "Recreating configure"
62 WANT_AUTOCONF=2.5 autoconf || die "autoconf failed"
63 eend $?
64 }
65
66 src_compile() {
67 local myconf
68
69 if [ -n "${NUT_DRIVERS}" ]; then
70 myconf="${myconf} --with-drivers=${NUT_DRIVERS// /,}"
71 fi
72
73 econf \
74 --with-user=nut \
75 --with-group=nut \
76 --with-drvpath=/lib/nut \
77 --sysconfdir=/etc/nut \
78 --with-logfacility=LOG_DAEMON \
79 --with-statepath=/var/lib/nut \
80 $(use_with ssl) \
81 $(use_with cgi) \
82 $(use_with cgi cgipath /usr/share/nut) \
83 ${myconf} || die "econf failed"
84
85 emake || die "compile problem"
86
87 if use snmp; then
88 emake snmp || die "snmp compile problem"
89 fi
90
91 if use usb; then
92 emake usb || die "usb compile problem"
93 fi
94
95 if use cgi; then
96 emake cgi || die "cgi compile problem"
97 fi
98 }
99
100 src_install() {
101 make DESTDIR="${D}" install install-lib || 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 snmp; then
109 make DESTDIR="${D}" install-snmp || die "make install-snmp failed"
110 fi
111
112 if use usb; then
113 make DESTDIR="${D}" install-usb || die "make install-usb failed"
114 fi
115
116 if use cgi; then
117 make DESTDIR="${D}" install-cgi || die "make install-cgi failed"
118 make DESTDIR="${D}" install-cgi-conf || die "make install-cgi-conf failed"
119 einfo "CGI monitoring scripts are installed in /usr/share/nut."
120 einfo "copy them to your web server's ScriptPath to activate."
121 einfo "If you use lighttpd, see lighttpd_nut.conf in the documentation."
122 fi
123
124 # this must be done after all of the install phases
125 for i in "${D}"/etc/nut/*.sample ; do
126 mv "${i}" "${i/.sample/}"
127 done
128
129 dodoc ChangeLog CREDITS INSTALL MAINTAINERS NEWS README UPGRADING \
130 docs/{FAQ,*.txt}
131
132 newdoc lib/README README.lib
133
134 dodoc ${FILESDIR}/lighttpd_nut.conf
135
136 docinto cables
137 dodoc docs/cables/*
138
139 newinitd "${FILESDIR}/upsd.rc6" upsd
140 newinitd "${FILESDIR}/upsdrv.rc6-r1" upsdrv
141 newinitd "${FILESDIR}/upsmon.rc6" upsmon
142
143 # This sets up permissions for nut to access a UPS
144 insinto /etc/udev/rules.d/
145 newins scripts/hotplug-ng/nut-usbups.rules 70-nut-usbups.rules
146
147 keepdir /var/lib/nut
148
149 fperms 0700 /var/lib/nut
150 fowners nut:nut /var/lib/nut
151
152 eval fperms 0640 ${NUT_PRIVATE_FILES}
153 eval fowners root:nut ${NUT_PRIVATE_FILES}
154
155 eval fperms 0644 ${NUT_PUBLIC_FILES}
156 eval fowners root:root ${NUT_PUBLIC_FILES}
157
158 # this is installed for 2.4 and fbsd guys
159 if ! has_version sys-fs/udev; then
160 insinto /etc/hotplug/usb
161 insopts -m 755
162 doins scripts/hotplug-ng/nut-usbups.hotplug
163 fi
164 }
165
166 pkg_postinst() {
167 # this is to ensure that everybody that installed old versions still has
168 # correct permissions
169 chown nut:nut ${ROOT}/var/lib/nut 2>/dev/null
170 chmod 0700 ${ROOT}/var/lib/nut 2>/dev/null
171
172 eval chown root:nut ${ROOT}${NUT_PRIVATE_FILES} 2>/dev/null
173 eval chmod 0640 ${ROOT}${NUT_PRIVATE_FILES} 2>/dev/null
174
175 eval chown root:root ${ROOT}${NUT_PUBLIC_FILES} 2>/dev/null
176 eval chmod 0644 ${ROOT}${NUT_PUBLIC_FILES} 2>/dev/null
177
178 warningmsg
179 }
180
181 warningmsg() {
182 ewarn "Please note that NUT now runs under the 'nut' user."
183 ewarn "NUT is in the tty group for access to RS-232 UPS."
184 ewarn "However if you use a USB UPS you may need to look at the udev or"
185 ewarn "hotplug rules that are installed."
186 }

  ViewVC Help
Powered by ViewVC 1.1.20