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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20