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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (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.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.3.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"
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 pkg_setup() {
31 enewgroup nut 84
32 enewuser nut 84 -1 /var/state/nut nut
33 }
34
35 src_unpack() {
36 unpack ${A}
37
38 cd "${S}"
39
40 sed -e "s/install: install-dirs/install: install-dirs install-conf/" \
41 -i Makefile.in || die "sed failed"
42
43 ht_fix_file configure.in
44
45 sed -e "s:GD_LIBS.*=.*-L/usr/X11R6/lib \(.*\) -lXpm -lX11:GD_LIBS=\"\1:" \
46 -i configure.in || die "sed failed"
47
48 ebegin "Recreating configure"
49 WANT_AUTOCONF=2.5 autoconf || die "autoconf failed"
50 eend $?
51 }
52
53 src_compile() {
54 local myconf
55
56 if [ -n "${NUT_DRIVERS}" ]; then
57 myconf="${myconf} --with-drivers=${NUT_DRIVERS// /,}"
58 fi
59
60 econf \
61 --with-user=nut \
62 --with-group=nut \
63 --with-drvpath=/lib/nut \
64 --sysconfdir=/etc/nut \
65 --with-logfacility=LOG_DAEMON \
66 --with-statepath=/var/lib/nut \
67 $(use_with ssl) \
68 $(use_with cgi) \
69 $(use_with cgi cgipath /usr/share/nut) \
70 ${myconf} || die "econf failed"
71
72 emake || die "compile problem"
73
74 if use snmp; then
75 emake snmp || die "snmp compile problem"
76 fi
77
78 if use usb; then
79 emake usb || die "usb compile problem"
80 fi
81
82 if use cgi; then
83 emake cgi || die "cgi compile problem"
84 fi
85 }
86
87 src_install() {
88 make DESTDIR="${D}" install install-lib || die "make install failed"
89
90 dodir /sbin
91 dosym /lib/nut/upsdrvctl /sbin/upsdrvctl
92 # This needs to exist for the scripts
93 dosym /lib/nut/upsdrvctl /usr/sbin/upsdrvctl
94
95 if use snmp; then
96 make DESTDIR="${D}" install-snmp || die "make install-snmp failed"
97 fi
98
99 if use usb; then
100 make DESTDIR="${D}" install-usb || die "make install-usb failed"
101 fi
102
103 if use cgi; then
104 make DESTDIR="${D}" install-cgi || die "make install-cgi failed"
105 make DESTDIR="${D}" install-cgi-conf || die "make install-cgi-conf failed"
106 einfo "CGI monitoring scripts are installed in /usr/share/nut,"
107 einfo "copy them to your web server's ScriptPath to activate."
108 fi
109
110 # this must be done after all of the install phases
111 for i in "${D}"/etc/nut/*.sample ; do
112 mv "${i}" "${i/.sample/}"
113 done
114
115 dodoc CHANGES CREDITS INSTALL MAINTAINERS NEWS README UPGRADING \
116 docs/{FAQ,*.txt}
117
118 newdoc lib/README README.lib
119
120 docinto cables
121 dodoc docs/cables/*
122
123 newinitd "${FILESDIR}/upsd.rc6" upsd
124 newinitd "${FILESDIR}/upsdrv.rc6-r1" upsdrv
125 newinitd "${FILESDIR}/upsmon.rc6" upsmon
126
127 # This sets up permissions for nut to access a UPS
128 insinto /etc/udev/rules.d/
129 newins scripts/hotplug-ng/nut-usbups.rules 70-nut-usbups.rules
130
131 keepdir /var/lib/nut
132
133 fperms 0700 /var/lib/nut
134 fowners nut:nut /var/lib/nut
135
136 fperms 0640 /etc/nut/{upsd.conf,upsd.users,upsmon.conf}
137 fowners root:nut /etc/nut/{upsd.conf,upsd.users,upsmon.conf}
138
139 fperms 0640 /etc/nut/{hosts.conf,upsset.conf,upsstats{,-single}.html}
140 fowners root:nut /etc/nut/{hosts.conf,upsset.conf,upsstats{,-single}.html}
141 }
142
143 pkg_postinst() {
144 # this is to ensure that everybody that installed old versions still has
145 # correct permissions
146 chown nut:nut ${ROOT}/var/lib/nut 2>/dev/null
147 chmod 0700 ${ROOT}/var/lib/nut 2>/dev/null
148
149 chown root:nut ${ROOT}/etc/nut/{upsd.conf,upsd.users,upsmon.conf} 2>/dev/null
150 chmod 0640 ${ROOT}/etc/nut/{upsd.conf,upsd.users,upsmon.conf} 2>/dev/null
151
152 chown root:nut ${ROOT}/etc/nut/{hosts.conf,upsset.conf,upsstats{,-single}.html} 2>/dev/null
153 chmod 0640 ${ROOT}/etc/nut/{hosts.conf,upsset.conf,upsstats{,-single}.html} 2>/dev/null
154 }

  ViewVC Help
Powered by ViewVC 1.1.20