Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37038264
en ru br
Репозитории ALT
S:2.8.0-alt2
5.1: 2.0.5-alt4
4.1: 2.0.5-alt3
4.0: 2.0.5-alt2
3.0: 2.0.2-alt1
www.altlinux.org/Changes

Группа :: Система/Серверы
Пакет: nut

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

# -*- rpm-spec -*-

Name: nut
Version: 2.0.5
Release: alt2

Summary: Network UPS Tools
License: GPL
Group: System/Servers
Url: http://random.networkupstools.org
Packager: Dmitry V. Levin <ldv at altlinux.org>

%define srcname nut-%version
# %url/source/2.0/nut-%version.tar.gz
Source: nut-%version.tar
Source1: upsdrv.init
Source2: upsd.init
Source3: upsmon.init
Source4: upsd.sysconfig

Patch1: nut-2.0.1-alt-timehead.patch
Patch2: nut-2.0.5-alt-chroot.patch
Patch3: nut-2.0.5-alt-upsdrvctl-list.patch
Patch4: nut-2.0.5-alt-makefile.patch
Patch5: nut-2.0.1-alt-upsstats.patch
Patch6: nut-2.0.5-alt-drivers.patch
Patch7: nut-2.0.5-alt-driverlist.patch

# Building under ALM24:

# rpmbuild --without cgi --define "_pkgconfigdir %_libdir/pkgconfig" ...

%def_with ssl
%def_with cgi
%def_without snmp
%def_with usb

%define confdir %_sysconfdir/%name
%define drvdir /lib/%name
%define cgidir /var/www/cgi-bin
%define htmldir /var/www/html/%name
%define runas upsmon
%define ROOT %_localstatedir/%name

PreReq: shadow-utils
Requires(post): %post_service
Requires(preun): %preun_service

BuildRequires: pkgconfig
%if_with ssl
BuildRequires: libssl-devel
%endif
%if_with cgi
BuildRequires: fontconfig-devel freetype2-devel libXpm-devel libgd2-devel libjpeg-devel libpng-devel
%endif
%if_with snmp
BuildRequires: libnet-snmp-devel
%endif
%if_with usb
BuildRequires: libusb-devel
%endif

%package server
Summary: The UPS information server
Group: System/Servers
PreReq: %name-driver = %version-%release
PreReq: shadow-utils
Requires(post): %post_service
Requires(preun): %preun_service

%package driver
Summary: The UPS drivers
Group: System/Servers
PreReq: %name = %version-%release
PreReq: shadow-utils
Requires(post): %post_service
Requires(preun): %preun_service

%package driver-snmp
Summary: Multi-MIB Driver for SNMP UPS equipment
Group: System/Servers
PreReq: %name-driver = %version-%release

%package driver-usb
Summary: Multi-HID Driver for USB/HID UPS equipment
Group: System/Servers
PreReq: %name-driver = %version-%release

%package cgi
Summary: CGI utilities for the Network UPS Tools
Group: System/Servers
Requires: webserver

%package devel
Summary: Header files and C programming manuals for nut
Group: Development/C

%description
These programs are part of a developing project to monitor the assortment
of UPSes that are found out there in the field.  Many models have serial
serial ports of some kind that allow some form of state checking.  This
capability has been harnessed where possible to allow for safe shutdowns,
live status tracking on web pages, and more.

This package includes the client utilities that are required to monitor a
UPS that the client host is powered from - either connected directly via
a serial port (in which case the %name-server package needs to be installed on
this machine) or across the network (where another host on the network
monitors the UPS via serial cable and runs the upsd from %name-server package
to allow clients to see the information).

%description server
These programs are part of a developing project to monitor the assortment
of UPSes that are found out there in the field.  Many models have serial
serial ports of some kind that allow some form of state checking.  This
capability has been harnessed where possible to allow for safe shutdowns,
live status tracking on web pages, and more.

This package contains the UPS information server.

%description driver
These programs are part of a developing project to monitor the assortment
of UPSes that are found out there in the field.  Many models have serial
serial ports of some kind that allow some form of state checking.  This
capability has been harnessed where possible to allow for safe shutdowns,
live status tracking on web pages, and more.

This package contains NUT per-UPS-model drivers which talk to the UPSes.

%description driver-snmp
These programs are part of a developing project to monitor the assortment
of UPSes that are found out there in the field.  Many models have serial
serial ports of some kind that allow some form of state checking.  This
capability has been harnessed where possible to allow for safe shutdowns,
live status tracking on web pages, and more.

This package contains somewhat experimental support of a wide range
of SNMP-aware UPS devices, including MGE and APC, for details
see snmp-ups(8).

%description driver-usb
These programs are part of a developing project to monitor the assortment
of UPSes that are found out there in the field.  Many models have serial
serial ports of some kind that allow some form of state checking.  This
capability has been harnessed where possible to allow for safe shutdowns,
live status tracking on web pages, and more.

This package contains somewhat experimental support of USB UPS devices,
for details see hidups(8) and newhidups(8).

%description cgi
These programs are part of a developing project to monitor the assortment
of UPSes that are found out there in the field.  Many models have serial
serial ports of some kind that allow some form of state checking.  This
capability has been harnessed where possible to allow for safe shutdowns,
live status tracking on web pages, and more.

This package includes CGI programs for accessing UPS status via a web
browser and can be installed on a separate machine to the rest of the
%name packages.

%description devel
These programs are part of a developing project to monitor the assortment
of UPSes that are found out there in the field.  Many models have serial
serial ports of some kind that allow some form of state checking.  This
capability has been harnessed where possible to allow for safe shutdowns,
live status tracking on web pages, and more.

This package includes static client library, header files and
C programming manuals for nut.

%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1

# cutout net-snmp-config madness

sed -i 's at ^\(NETSNMP_CFLAGS=\)`.\+$ at \1%optflags at ' configure
sed -i 's at ^\(NETSNMP_LIBS=`\).\+$ at \1echo -lnetsnmp -lcrypto` at ' configure

%build
%configure \
--sysconfdir=%confdir --datadir=%confdir \
--includedir=%_includedir/%name \
%{subst_with cgi} --with-cgipath=%cgidir --with-htmlpath=%htmldir \
%{subst_with ssl} \
%{?_with_usb:--with-linux-hiddev=%_includedir/linux/hiddev.h} \
--with-drvpath=%drvdir \
--with-statepath=%_localstatedir/upsd \
--with-user=%runas \
--disable-strip

%make_build USE_PKG_CFG=yes PKG_CFG_DIR=%_pkgconfigdir
%{?_with_cgi:%make_build build-cgi}
%{?_with_usb:%make_build build-usb}
%{?_with_snmp:%make_build build-snmp}

%install
%make_install install \
DESTDIR=%buildroot \
USE_PKG_CFG=yes \
PKG_CFG_DIR=%buildroot%_pkgconfigdir \
install-conf install-lib \
%{?_with_cgi:install-cgi install-cgi-conf} \
%{?_with_snmp:install-snmp} \
%{?_with_usb:install-usb} \
#

# Since %drvdir != /sbin, we have to create /sbin/upsdrvctl manually.

mkdir -p %buildroot/sbin
ln -s %drvdir/upsdrvctl %buildroot/sbin/

# Provide %drvdir/newapc for compatibility with nut-1.4.x

ln -s apcsmart %buildroot%drvdir/newapc

# Install start/stop scripts.

install -pD -m755 %SOURCE1 %buildroot%_initdir/upsdrv
install -pD -m755 %SOURCE2 %buildroot%_initdir/upsd
install -pD -m755 %SOURCE3 %buildroot%_initdir/upsmon
install -pD -m644 %SOURCE4 %buildroot%_sysconfdir/sysconfig/upsd

# SSL infrastucture.

mkdir -p %buildroot%confdir/certs
touch %buildroot%confdir/upsd.pem

# Prepare chroot jail for upsd/upsdrv.

mkdir -p %buildroot%ROOT{/dev,%confdir,%_localstatedir/upsd}
ln -s %name%_localstatedir/upsd %buildroot%_localstatedir/
pushd %buildroot
cp -p .%confdir/ups.conf .%ROOT%confdir/
for f in upsd.conf upsd.users upsd.pem cmdvartab; do
mv .%confdir/$f .%ROOT%confdir/
ln -s `relative %ROOT%confdir/$f %confdir/` .%confdir/
done
popd

# Make use of syslogd-1.4.1-alt11 /etc/syslog.d/ feature.

mksock %buildroot%ROOT/dev/log
mkdir -p %buildroot%_sysconfdir/syslog.d
ln -s %ROOT/dev/log %buildroot%_sysconfdir/syslog.d/%name

%define docdir %_docdir/%name-%version
rm -rf %buildroot%docdir
mkdir -p %buildroot%docdir
cp -a CREDITS INSTALL MAINTAINERS NEWS README UPGRADING \
     docs/FAQ docs/*.txt docs/cables \
%buildroot%docdir/

%pre
if [ $1 -gt 1 -a -x /sbin/upsmon -a ! -d /etc/nut/certs ]; then
echo "Upgrading from incompatible nut < 1.4.1-alt2" >&2
[ -x %_initdir/upsmon ] && service upsmon condstop ||:
[ -x %_initdir/upsd ] && service upsd condstop ||:
if [ ! -d "%confdir" -o -e "%confdir".bak ] ||
  ! mv -v "%confdir" "%confdir".bak; then
echo "Automatic upgrade failed." >&2
exit 1
fi
echo "Please update config files manually." >&2
fi
/usr/sbin/groupadd -r -f %runas
/usr/sbin/useradd -r -g %runas -d / -s /dev/null \
-c "NUT monitoring daemon" -n %runas >/dev/null 2>&1 ||:

%post
%post_service upsmon

%preun
%preun_service upsmon

%pre driver
/usr/sbin/groupadd -r -f upsdrv
/usr/sbin/useradd -r -g upsdrv -G uucp -d %ROOT -s /dev/null \
-c "NUT drivers" -n upsdrv >/dev/null 2>&1 ||:

%post driver
%post_service upsdrv

%preun driver
%preun_service upsdrv

%pre server
/usr/sbin/groupadd -r -f upsd
/usr/sbin/useradd -r -g upsd -G upsdrv -d %ROOT -s /dev/null \
-c "NUT information server" -n upsd >/dev/null 2>&1 ||:

%post server
%post_service upsd

%preun server
%preun_service upsd

%files
%dir %confdir
%dir %attr(710,root,%runas) %confdir/certs
%config(noreplace) %attr(640,root,%runas) %confdir/upsmon.conf
%config(noreplace) %attr(640,root,%runas) %confdir/upssched.conf
%_initdir/upsmon

%_bindir/upsc
%_bindir/upscmd
%_bindir/upslog
%_bindir/upsrw
%_sbindir/upsmon
%_sbindir/upssched

%_man5dir/upsmon.conf.*
%_man5dir/upssched.conf.*
%_man8dir/upsc.*
%_man8dir/upscmd.*
%_man8dir/upslog.*
%_man8dir/upsmon.*
%_man8dir/upsrw.*
%_man8dir/upssched.*

%dir %docdir
%docdir/[A-Z][A-Z]*
%docdir/*.txt
%exclude %docdir/*driver*

%files driver
%config(noreplace) %_sysconfdir/sysconfig/upsd
%config %_initdir/upsdrv
%dir %confdir
%config %confdir/driver.list
%config(noreplace) %attr(640,root,upsdrv) %confdir/ups.conf

%drvdir
%if_with snmp
%exclude %drvdir/snmp-ups
%endif # with_snmp
%if_with usb
%exclude %drvdir/hidups
%exclude %drvdir/newhidups
%exclude %drvdir/energizerups
%endif # with_usb
/sbin/upsdrvctl

%_man5dir/ups.conf.*
%_man8dir/*
%exclude %_man8dir/upsc.*
%exclude %_man8dir/upscmd.*
%exclude %_man8dir/upsd.*
%exclude %_man8dir/upslog.*
%exclude %_man8dir/upsmon.*
%exclude %_man8dir/upsrw.*
%exclude %_man8dir/upssched.*
%if_with cgi
%exclude %_man8dir/upsimage.cgi.*
%exclude %_man8dir/upsset.cgi.*
%exclude %_man8dir/upsstats.cgi.*
%endif # with_cgi
%if_with snmp
%exclude %_man8dir/snmp-ups.*
%endif # with_snmp
%if_with usb
%exclude %_man8dir/hidups.*
%exclude %_man8dir/newhidups.*
%exclude %_man8dir/energizerups.*
%endif # with_usb

%_localstatedir/upsd
%_sysconfdir/syslog.d/*
%dir %attr(0710,root,upsdrv) %ROOT
%dir %attr(0710,root,upsdrv) %ROOT/dev
%ghost %attr(666,root,root) %ROOT/dev/*
%dir %attr(0710,root,upsdrv) %ROOT/var
%dir %attr(0710,root,upsdrv) %ROOT%_localstatedir
%dir %attr(1730,root,upsdrv) %ROOT%_localstatedir/upsd
%dir %attr(0710,root,upsdrv) %ROOT%_sysconfdir
%dir %attr(0710,root,upsdrv) %ROOT%confdir
%attr(640,root,upsdrv) %ROOT%confdir/ups.conf

%dir %docdir
%docdir/*driver*
%docdir/cables

%files server
%config %_initdir/upsd
%dir %confdir
%confdir/cmdvartab
%confdir/upsd.conf
%confdir/upsd.users
%confdir/upsd.pem
%config(noreplace) %attr(640,root,upsdrv) %confdir/ups.conf

%_sbindir/upsd

%_man5dir/upsd.conf.*
%_man5dir/upsd.users.*
%_man8dir/upsd.*

%_sysconfdir/syslog.d/*
%dir %attr(0710,root,upsdrv) %ROOT
%dir %attr(0710,root,upsdrv) %ROOT/dev
%ghost %attr(666,root,root) %ROOT/dev/*
%dir %attr(0710,root,upsdrv) %ROOT/var
%dir %attr(0710,root,upsdrv) %ROOT%_localstatedir
%dir %attr(1730,root,upsdrv) %ROOT%_localstatedir/upsd
%dir %attr(0710,root,upsdrv) %ROOT%_sysconfdir
%dir %attr(0710,root,upsdrv) %ROOT%confdir
%config(noreplace) %attr(640,root,upsd) %ROOT%confdir/cmdvartab
%config(noreplace) %attr(640,root,upsd) %ROOT%confdir/upsd.conf
%config(noreplace) %attr(640,root,upsd) %ROOT%confdir/upsd.users
%config(noreplace) %attr(640,root,upsd) %ROOT%confdir/upsd.pem
%attr(640,root,upsdrv) %ROOT%confdir/ups.conf

%if_with snmp
%files driver-snmp
%dir %drvdir
%drvdir/snmp-ups
%_man8dir/snmp-ups.*
%endif # with_snmp

%if_with usb
%files driver-usb
%dir %drvdir
%drvdir/hidups
%drvdir/newhidups
%drvdir/energizerups
%_man8dir/hidups.*
%_man8dir/newhidups.*
%_man8dir/energizerups.*
%endif # with_usb

%if_with cgi
%files cgi
%dir %confdir
%config(noreplace) %confdir/hosts.conf
%config(noreplace) %confdir/upsset.conf
%config(noreplace) %confdir/upsstats.html
%config(noreplace) %confdir/upsstats-single.html
%cgidir/upsimage.cgi
%cgidir/upsset.cgi
%cgidir/upsstats.cgi
%htmldir
%doc data/html/README
%_man5dir/hosts.conf.*
%_man5dir/upsset.conf.*
%_man5dir/upsstats.html.*
%_man8dir/upsimage.cgi.*
%_man8dir/upsset.cgi.*
%_man8dir/upsstats.cgi.*
%endif # with_cgi

%files devel
%_bindir/*-config
%_includedir/*
%_pkgconfigdir/*.pc
%_libdir/libupsclient.a
%_man3dir/*

%changelog

Полный changelog можно просмотреть здесь

 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin