/[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.1 - (hide annotations) (download)
Sun Feb 25 02:57:28 2007 UTC (13 years, 1 month ago) by robbat2
Branch: MAIN
Version bump, bug #162657.
(Portage version: 2.1.2-r9)

1 robbat2 1.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-r1.ebuild,v 1.10 2006/10/26 22:05:34 blubb 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="~alpha ~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     warningmsg
41     }
42    
43     src_unpack() {
44     unpack ${A}
45    
46     EPATCH_OPTS="-p1 -d ${S}" epatch ${FILESDIR}/upsstats-upsset-link-2.0.5.patch
47    
48     cd "${S}"
49    
50     sed -e "s/install: install-dirs/install: install-dirs install-conf/" \
51     -i Makefile.in || die "sed failed"
52    
53     ht_fix_file configure.in
54    
55     sed -e "s:GD_LIBS.*=.*-L/usr/X11R6/lib \(.*\) -lXpm -lX11:GD_LIBS=\"\1:" \
56     -i configure.in || die "sed failed"
57    
58     ebegin "Recreating configure"
59     WANT_AUTOCONF=2.5 autoconf || die "autoconf failed"
60     eend $?
61     }
62    
63     src_compile() {
64     local myconf
65    
66     if [ -n "${NUT_DRIVERS}" ]; then
67     myconf="${myconf} --with-drivers=${NUT_DRIVERS// /,}"
68     fi
69    
70     econf \
71     --with-user=nut \
72     --with-group=nut \
73     --with-drvpath=/lib/nut \
74     --sysconfdir=/etc/nut \
75     --with-logfacility=LOG_DAEMON \
76     --with-statepath=/var/lib/nut \
77     $(use_with ssl) \
78     $(use_with cgi) \
79     $(use_with cgi cgipath /usr/share/nut) \
80     ${myconf} || die "econf failed"
81    
82     emake || die "compile problem"
83    
84     if use snmp; then
85     emake snmp || die "snmp compile problem"
86     fi
87    
88     if use usb; then
89     emake usb || die "usb compile problem"
90     fi
91    
92     if use cgi; then
93     emake cgi || die "cgi compile problem"
94     fi
95     }
96    
97     src_install() {
98     make DESTDIR="${D}" install install-lib || die "make install failed"
99    
100     dodir /sbin
101     dosym /lib/nut/upsdrvctl /sbin/upsdrvctl
102     # This needs to exist for the scripts
103     dosym /lib/nut/upsdrvctl /usr/sbin/upsdrvctl
104    
105     if use snmp; then
106     make DESTDIR="${D}" install-snmp || die "make install-snmp failed"
107     fi
108    
109     if use usb; then
110     make DESTDIR="${D}" install-usb || die "make install-usb failed"
111     fi
112    
113     if use cgi; then
114     make DESTDIR="${D}" install-cgi || die "make install-cgi failed"
115     make DESTDIR="${D}" install-cgi-conf || die "make install-cgi-conf failed"
116     einfo "CGI monitoring scripts are installed in /usr/share/nut."
117     einfo "copy them to your web server's ScriptPath to activate."
118     einfo "If you use lighttpd, see lighttpd_nut.conf in the documentation."
119     fi
120    
121     # this must be done after all of the install phases
122     for i in "${D}"/etc/nut/*.sample ; do
123     mv "${i}" "${i/.sample/}"
124     done
125    
126    
127     dodoc ChangeLog CREDITS INSTALL MAINTAINERS NEWS README UPGRADING \
128     docs/{FAQ,*.txt}
129    
130     newdoc lib/README README.lib
131    
132     dodoc ${FILESDIR}/lighttpd_nut.conf
133    
134     docinto cables
135     dodoc docs/cables/*
136    
137    
138     exeinto /etc/init.d
139     newexe "${FILESDIR}/upsd.rc6" upsd
140     newexe "${FILESDIR}/upsdrv.rc6-r1" upsdrv
141     newexe "${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