1%define nut_id @RUN_AS_USER@ 2%define nut_group @RUN_AS_GROUP@ 3 4%define _prefix /usr/local/ups 5%define _docdir %{_datadir}/doc 6 7%define confdir %{_prefix}/etc 8%define rcdir /etc/rc.d 9%define initdir %{rcdir}/init.d 10%define cgidir /var/www/nut-cgi-bin 11%define piddir /var/run/nut 12 13Summary: Network UPS Tools 14Name: nut 15Version: @PACKAGE_VERSION@ 16Release: 1 17Group: Applications/System 18License: GPLv2+ 19Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 20Url: http://www.networkupstools.org/ 21Source: http://www.networkupstools.org/source/@TREE_VERSION@/%{name}-%{version}.tar.gz 22Source1: nut.init 23#Source2: ups.sysconfig 24#Source3: nut-client.tmpfiles 25 26 27# FIXME: adjust according to what is available through RPM on Aix 28BuildRequires: libtool 29BuildRequires: net-snmp-devel 30BuildRequires: openssl-devel 31BuildRequires: pkgconfig 32 33# AIX BUILDERS, PLEASE NOTE: 34# If building with xlc version 3.6.X rather than gcc, you must ensure 35# you have the following PTF's installed on your system, or 36# you will see a runtime error that says: 37# "Expected </Directory> but saw </Directory>" 38# PTFS needed: U462006 U462007 U462023 U462024 U462025 U462026 U462027 39# Refer to http://service.software.ibm.com/support/rs6000, or 40# set CC=gcc to force use of the GCC compiler. 41# 42# %define stdlib lib 43# %define liblink ../.. 44# %define DEFCC xlc 45 46%description 47Network UPS Tools (NUT) is a client/server monitoring system that allows 48computers to share uninterruptible power supply (UPS) and power distribution 49unit (PDU) hardware. Clients access the hardware through the server, and are 50notified whenever the power status changes. 51 52%package client 53Group: Applications/System 54Summary: Network UPS Tools client monitoring utilities 55#Requires(post): chkconfig 56#Requires(preun): chkconfig 57#Requires(pre): shadow-utils 58 59%description client 60This package includes the client utilities that are required to monitor a 61ups that the client host has access to, but where the UPS is physically 62attached to a different computer on the network. 63 64%package devel 65Group: Development/Libraries 66Summary: Development files for NUT Client 67Requires: %{name}-client = %{version}-%{release} webserver openssl-devel 68 69%description devel 70This package contains the development header files and libraries 71necessary to develop NUT client applications. 72 73%prep 74%setup -q 75 76%build 77/usr/bin/rm configure.in 78 79%configure \ 80 --with-all \ 81 --without-powerman \ 82 --without-avahi \ 83 --without-usb \ 84 --without-ipmi \ 85 --without-cgi \ 86 --datadir=%{_datadir}/%{name} \ 87 --with-user=%{nut_id} \ 88 --with-group=%{nut_group} \ 89 --with-statepath=%{piddir} \ 90 --with-pidpath=%{piddir} \ 91 --with-altpidpath=%{piddir} \ 92 --sysconfdir=%{confdir} \ 93 --with-cgipath=%{cgidir} \ 94 --with-drvpath=%{_sbindir} \ 95 --with-pkgconfig-dir=%{_libdir}/pkgconfig \ 96 --disable-static \ 97 --libdir=%{_libdir} \ 98 --program-transform-name=s,^%{_target_platform}-,, \ 99 LDFLAGS="$LDFLAGS -Wl,-brtl" \ 100# --with-libltdl-includes=/opt/freeware/share/libtool/libltdl/libltdl/ \ 101# --with-libltdl-libs=/opt/freeware/lib \ 102# --with-doc \ asciidoc >= 8.6.3 is required 103 104# FIXME: remove rpath? 105#sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool 106#sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool 107 108make %{?_smp_mflags} 109 110%install 111/usr/bin/rm -rf %{buildroot} 112 113/usr/bin/mkdir -p %{buildroot}%{_sbindir} \ 114 %{buildroot}%{piddir} \ 115 %{buildroot}%{_libdir}/ups \ 116 %{buildroot}%{initdir} \ 117 %{buildroot}%{_libexecdir} 118 119make install DESTDIR=%{buildroot} 120 121install -m 755 %{SOURCE1} %{buildroot}%{initdir}/ups 122 123/usr/bin/rm -f %{buildroot}%{_libdir}/*.la 124 125# Remove ".sample" suffix from the config filenames 126#pushd conf; 127#make install DESTDIR=%{buildroot} 128#for file in %{buildroot}%{confdir}/*.sample 129#do 130# mv $file %{buildroot}%{confdir}/`basename $file .sample` 131#done 132#popd 133 134%pre 135/usr/bin/test -L %{_libdir}/ups || \ 136/usr/bin/mkdir -p %{_libdir}/ups 137/usr/bin/grep -qc %{nut_group} /etc/group || \ 138/usr/bin/mkgroup %{nut_group} 139/usr/bin/grep -qc %{nut_id} /etc/passwd || \ 140/usr/sbin/useradd -c "Network UPS Tools" \ 141 -g %{nut_group} -d %{_libdir}/ups %{nut_id} 142/usr/bin/test -L %{piddir} || \ 143/usr/bin/mkdir -p %{piddir} 144/usr/bin/chmod 750 %{piddir} 145/usr/bin/chown %{nut_id}:%{nut_group} %{piddir} 146 147%post 148/usr/bin/test -L %{rcdir}/rc2.d/Sups || \ 149/usr/bin/ln -s %{initdir}/ups %{rcdir}/rc2.d/Sups 150/usr/bin/test -L %{rcdir}/rc2.d/Kups || \ 151/usr/bin/ln -s %{initdir}/ups %{rcdir}/rc2.d/Kups 152exit 0 153 154%preun 155%{initdir}/ups stop 156if [ "$1" = "0" ]; then 157 /usr/bin/rm -f %{rcdir}/rc2.d/[SK]ups 158fi 159exit 0 160 161%postun 162if [ "$1" = "0" ]; then 163 /usr/bin/grep -qc %{nut_id} /etc/passwd && \ 164 /usr/sbin/userdel %{nut_id} 165 /usr/bin/grep -qc %{nut_group}: /etc/group && \ 166 /usr/sbin/rmgroup %{nut_group} 167 /usr/bin/test -L %{piddir} && \ 168 /usr/bin/rm -rf %{piddir} 169 /usr/bin/test -L %{_libdir}/ups && \ 170 /usr/bin/rm -rf %{_libdir}/ups 171fi 172exit 0 173 174%pre client 175/usr/bin/grep -qc %{nut_group}: /etc/group || \ 176/usr/bin/mkgroup %{nut_group} 177/usr/bin/grep -qc %{nut_id} /etc/passwd || \ 178/usr/sbin/useradd -c "Network UPS Tools" \ 179 -g %{nut_group} -d %{_libdir}/ups %{nut_id} 180/usr/bin/test -L %{piddir} || \ 181/usr/bin/mkdir -p %{piddir} 182/usr/bin/chmod 750 %{piddir} 183/usr/bin/chown %{nut_id}:%{nut_group} %{piddir} 184 185%post client 186/usr/bin/test -L %{rcdir}/rc2.d/Sups || \ 187/usr/bin/ln -s %{initdir}/ups %{rcdir}/rc2.d/Sups 188/usr/bin/test -L %{rcdir}/rc2.d/Kups || \ 189/usr/bin/ln -s %{initdir}/ups %{rcdir}/rc2.d/Kups 190#%{initdir}/ups start 191exit 0 192 193%preun client 194%{initdir}/ups stop 195remove="no" 196if /usr/bin/rpm -q nut >/dev/null 2>&1; then 197 remove="no" 198elif [ "$1" = "0" ]; then 199 remove="yes" 200fi 201if [ "$remove" = "yes" ]; then 202 /usr/bin/rm -f %{rcdir}/rc2.d/[SK]ups 203 /usr/bin/test -L %{piddir} && \ 204 /usr/bin/rm -rf %{piddir} 205fi 206exit 0 207 208%postun client 209remove="no" 210if /usr/bin/rpm -q nut >/dev/null 2>&1; then 211 remove="no" 212elif [ "$1" = "0" ]; then 213 remove="yes" 214fi 215if [ "$remove" = "yes" ]; then 216 /usr/bin/grep -qc %{nut_id} /etc/passwd && \ 217 /usr/sbin/userdel %{nut_id} 218 /usr/bin/grep -qc %{nut_group}: /etc/group && \ 219 /usr/sbin/rmgroup %{nut_group} 220#else 221# %{initdir}/ups start 222fi 223exit 0 224 225%clean 226/usr/bin/rm -rf %{buildroot} 227 228%files 229%defattr(-,root,root,-) 230%attr(755,root,root) %{initdir}/ups 231%doc COPYING ChangeLog AUTHORS MAINTAINERS README docs UPGRADING INSTALL NEWS 232%config(noreplace) %attr(640,root,%nut_group) %{confdir}/nut.conf.sample 233%config(noreplace) %attr(640,root,%nut_group) %{confdir}/ups.conf.sample 234%config(noreplace) %attr(640,root,%nut_group) %{confdir}/upsd.conf.sample 235%config(noreplace) %attr(640,root,%nut_group) %{confdir}/upsd.users.sample 236%dir %attr(750,%nut_id,%nut_group) %{_libdir}/ups 237#%ghost %{piddir} 238%{_sbindir}/* 239%{_bindir}/upslog 240%{_bindir}/nutconf 241%{_libdir}/libnutscan.so* 242%{_libdir}/libupsclient.so* 243%{_datadir}/%{name}/cmdvartab 244%{_datadir}/%{name}/driver.list 245%{_mandir}/man5/nut.conf.5 246%{_mandir}/man5/ups.conf.5 247%{_mandir}/man5/upsd.conf.5 248%{_mandir}/man5/upsd.users.5 249%{_mandir}/man8/apcsmart.8 250%{_mandir}/man8/bcmxcp.8 251#%{_mandir}/man8/bcmxcp_usb.8 252%{_mandir}/man8/belkin.8 253%{_mandir}/man8/bestfcom.8 254%{_mandir}/man8/belkinunv.8 255%{_mandir}/man8/bestfortress.8 256%{_mandir}/man8/bestups.8 257%{_mandir}/man8/bestuferrups.8 258%{_mandir}/man8/blazer.8 259%{_mandir}/man8/clone.8 260%{_mandir}/man8/dummy-ups.8 261%{_mandir}/man8/everups.8 262%{_mandir}/man8/etapro.8 263%{_mandir}/man8/gamatronic.8 264%{_mandir}/man8/genericups.8 265%{_mandir}/man8/isbmex.8 266%{_mandir}/man8/ivtscd.8 267%{_mandir}/man8/liebert.8 268%{_mandir}/man8/liebert-esp2.8 269%{_mandir}/man8/masterguard.8 270%{_mandir}/man8/metasys.8 271%{_mandir}/man8/microdowell.8 272%{_mandir}/man8/mge-utalk.8 273%{_mandir}/man8/mge-shut.8 274%{_mandir}/man8/nutupsdrv.8 275%{_mandir}/man8/oneac.8 276%{_mandir}/man8/optiups.8 277%{_mandir}/man8/powercom.8 278#%{_mandir}/man8/powerman-pdu.8 279%{_mandir}/man8/powerpanel.8 280%{_mandir}/man8/rhino.8 281#%{_mandir}/man8/richcomm_usb.8 282%{_mandir}/man8/safenet.8 283%{_mandir}/man8/snmp-ups.8 284%{_mandir}/man8/solis.8 285%{_mandir}/man8/tripplite.8 286#%{_mandir}/man8/tripplite_usb.8 287%{_mandir}/man8/tripplitesu.8 288%{_mandir}/man8/victronups.8 289%{_mandir}/man8/upscode2.8 290%{_mandir}/man8/upsd.8 291%{_mandir}/man8/upsdrvctl.8 292 293%files client 294%doc COPYING 295%defattr(-,root,root) 296%attr(755,root,root) %{initdir}/ups 297%dir %{confdir} 298%config(noreplace) %attr(640,root,%nut_group) %{confdir}/upsmon.conf.sample 299%config(noreplace) %attr(640,root,%nut_group) %{confdir}/upssched.conf.sample 300%dir %attr(750,%nut_id,%nut_group) %{_libdir}/ups 301#%ghost %{piddir} 302%{_bindir}/upsc 303%{_bindir}/upscmd 304%{_bindir}/upsrw 305%{_sbindir}/upsmon 306%{_sbindir}/upssched 307%{_bindir}/upssched-cmd 308%{_libdir}/libupsclient.so* 309%{_mandir}/man5/upsmon.conf.5 310%{_mandir}/man5/upssched.conf.5 311%{_mandir}/man8/upsc.8 312%{_mandir}/man8/upscmd.8 313%{_mandir}/man8/upsrw.8 314%{_mandir}/man8/upslog.8 315%{_mandir}/man8/upsmon.8 316%{_mandir}/man8/upssched.8 317 318%files devel 319%defattr(-,root,root,-) 320%{_includedir}/* 321%{_mandir}/man3/upscli* 322%{_libdir}/libupsclient.so* 323%{_libdir}/pkgconfig/libupsclient.pc 324 325%changelog 326* Tue Jul 12 2014 Arnaud Quette <arnaud.quette@free.fr> - 2.7.2-1.master 327- Minor adjustments 328 329* Tue Jul 12 2011 Arnaud Quette <ArnaudQuette@Eaton.com> - 2.6.5-1.trunk 330- derive from RHEL 2.6.1-2, and adapt for Aix 6.1 331