SHA256
1
0
forked from pool/nut
OBS User unknown 2007-10-22 16:32:43 +00:00 committed by Git OBS Bridge
parent 0623bea7b1
commit 124f4eaa72
5 changed files with 84 additions and 14 deletions

View File

@ -34,7 +34,7 @@ It requires only few adoptions before you can start the service:
* Configuration of a UPS connected to a remote machine:
In /etc/ups/ups.conf:
In /etc/ups/ups.conf:
- Comment out or remove the [myups] section at the end of the
file.
@ -55,10 +55,21 @@ MONITOR myups@remote_machine 1 upsslave remote_password slave
the remote machine.
- Change the description as you want.
In the remote /etc/ups/upsd.conf:
- Add a rule for the remote clients relevant to your network or
your needs. Standard local networks are:
10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16
ACL my_network 192.168.0.0/16
ACCEPT my_network
In the remote /etc/ups/upsd.users:
- Find the line allowfrom for upsslave user.
- Add your local machine name to the allowfrom list.
In the remote SuSE firewall:
- Enable nut (Network UPS Tools) service (port 3493), e. g. by
"YaST2 firewall".
Start the service:
- "/etc/init.d/upsd start" on both local and remote machines.
- If you have edited configuration of a running server, run

16
nut-udev.patch Normal file
View File

@ -0,0 +1,16 @@
--- scripts/udev/nut-usbups.rules.in
+++ scripts/udev/nut-usbups.rules.in
@@ -1,7 +1,11 @@
# udev rules for the NUT USB drivers
-SUBSYSTEM!="usb_device", GOTO="nut-usbups_rules_end"
ACTION!="add", GOTO="nut-usbups_rules_end"
+SUBSYSTEM=="usb_device", GOTO="nut-usbups_rules_real"
+SUBSYSTEM=="usb", GOTO="nut-usbups_rules_real"
+BUS!="usb", GOTO="nut-usbups_rules_end"
+
+LABEL="nut-usbups_rules_real"
# MGE UPS SYSTEMS - usbhid-ups
SYSFS{idVendor}=="0463", SYSFS{idProduct}=="ffff", MODE="664", GROUP="uucp"

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Oct 22 17:39:41 CEST 2007 - sbrabec@suse.cz
- Fixed udev USB rules for current kernels (#331749).
- Added SuSEfirewall2 rule and fixed documentation (#335466).
-------------------------------------------------------------------
Tue Aug 7 19:08:04 CEST 2007 - sbrabec@suse.cz

17
nut.firewall.in Normal file
View File

@ -0,0 +1,17 @@
## Name: Network UPS Tools
## Description: Opens ports for remote UPS signalling for Network UPS Tools.
# space separated list of allowed TCP ports
TCP="@PORT@"
# space separated list of allowed UDP ports
UDP="@PORT@"
# space separated list of allowed RPC services
RPC=""
# space separated list of allowed IP protocols
IP=""
# space separated list of allowed UDP broadcast ports
BROADCAST=""

View File

@ -19,20 +19,22 @@ Requires: %{_bindir}/pgrep %{_bindir}/pkill %{_bindir}/grep %{_bindir}/fgr
Requires: powersave
Obsoletes: smartups
Conflicts: apcupsd
Autoreqprov: on
AutoReqProv: on
Summary: UPS Monitoring Software
Version: 2.2.0
Release: 1
URL: http://www.networkupstools.org/
Release: 28
Url: http://www.networkupstools.org/
Source: %{name}-%{version}.tar.bz2
Source1: upsd.init
Source2: README.SUSE
Source3: upsd-early-powerdown.init
Source4: upsd.dbus-1
Source5: nut.firewall.in
Patch: nut-preconfig.patch
Patch3: nut-notifyflag.patch
Patch4: nut-powersave.patch
Patch5: nut-pkgconfig.patch
Patch6: nut-udev.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: %insserv_prereq /bin/chown /bin/chmod %{_bindir}/fgrep %{_bindir}/grep %{_bindir}/sed %{_bindir}/head %{_bindir}/md5sum
%define apache_serverroot %(%{_sbindir}/apxs2 -q datadir 2>/dev/null || %{_sbindir}/apxs -q PREFIX)
@ -42,6 +44,7 @@ PreReq: %insserv_prereq /bin/chown /bin/chmod %{_bindir}/fgrep %{_bindir
%define STATEPATH %{_localstatedir}/lib/ups
%define CONFPATH %{_sysconfdir}/ups
%define USER upsd
%define GROUP daemon
%description
This is a developing project to monitor a large assortment of UPS
@ -134,13 +137,16 @@ Authors:
%{_datadir}/doc/packages/nut/README.
%prep
%setup -q
cp -a %{S:1} %{S:2} %{S:3} %{S:4} .
cp -a %{S:1} %{S:2} %{S:3} %{S:4} %{S:5} .
mv upsd-early-powerdown.init upsd-early-powerdown
%patch
%patch3
%patch4
%patch5
sed -i "s/@UPSD_USER@/%USER/g" upsd.init conf/upsmon.conf.sample
%if %suse_version >= 1030
%patch6
%endif
sed -i "s/@UPSD_USER@/%{USER}/g" upsd.init conf/upsmon.conf.sample
%build
autoreconf -f -i
@ -154,8 +160,13 @@ autoreconf -f -i
--with-statepath=%{STATEPATH}\
--with-drvpath=%{MODELPATH}\
--with-user=%{USER}\
--with-group=uucp
--with-group=%{GROUP}
make %{?jobs:-j%jobs}
PORT=$(sed -n 's/#define PORT //p' config.log)
if "$PORT" = 3493 ; then
PORT=nut
fi
sed s/@PORT@/$PORT/ <nut.firewall.in >nut.firewall
%install
make DESTDIR=$RPM_BUILD_ROOT install
@ -165,14 +176,18 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
install -m 755 upsd.init $RPM_BUILD_ROOT%{_sysconfdir}/init.d/upsd
ln -sf ../..%{_sysconfdir}/init.d/upsd $RPM_BUILD_ROOT%{_sbindir}/rcupsd
mkdir -p $RPM_BUILD_ROOT%STATEPATH
mkdir -p $RPM_BUILD_ROOT%{STATEPATH}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d
install -m 644 upsd.dbus-1 $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d/upsd.conf
rename .sample "" $RPM_BUILD_ROOT%{_sysconfdir}/ups/*.sample
%if %suse_version >= 1030
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services
cp nut.firewall $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/nut
%endif
%pre
usr/sbin/useradd -r -o -g daemon -s /bin/false \
-c "UPS daemon" -d /sbin %USER 2>/dev/null || :
usr/sbin/useradd -r -o -g %{GROUP} -s /bin/false \
-c "UPS daemon" -d /sbin %{USER} 2>/dev/null || :
%post
%{fillup_and_insserv -f -n upsd}
@ -186,8 +201,8 @@ if usr/bin/fgrep -q "password = @UPSD_INITIAL_SLAVE_PASSWORD@" %{CONFPATH}/upsd.
usr/bin/sed -i s/@UPSD_INITIAL_SLAVE_PASSWORD@/$UPSD_INITIAL_SLAVE_PASSWORD/ %{CONFPATH}/upsd.users
fi
# Be sure that all files are owned by a dedicated user.
bin/chown -R %USER:root %STATEPATH
bin/chown %USER:root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users
bin/chown -R %{USER}:root %{STATEPATH}
bin/chown %{USER}:root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users
bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users
# Install HALT_POWERDOWN_INSERT
if usr/bin/grep -q '^HALT_POWERDOWN_INSERT="\(%{_sysconfdir}/init\.d/upsd try-powerdown\|\)"' etc/sysconfig/shutdown ; then
@ -228,6 +243,9 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog MAINTAINERS NEWS README README.SUSE UPGRADING upsd-early-powerdown docs/FAQ docs/*.txt docs/cables
%if %suse_version >= 1030
%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/nut
%endif
%{_sysconfdir}/init.d/upsd
%{_sysconfdir}/dbus-1/system.d/upsd.conf
%{_sysconfdir}/udev/rules.d/*.rules
@ -253,7 +271,7 @@ rm -rf $RPM_BUILD_ROOT
%{HTMLPATH}/*.html
%{HTMLPATH}/*.png
%{MODELPATH}
%attr(700,%{USER},uucp) %{STATEPATH}
%attr(700,%{USER},%{GROUP}) %{STATEPATH}
%files devel
%defattr(-,root,root)
@ -263,8 +281,10 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/*.*a
%{_libdir}/pkgconfig/*.pc
%doc %{_mandir}/man3/*.*
%changelog
* Mon Oct 22 2007 - sbrabec@suse.cz
- Fixed udev USB rules for current kernels (#331749).
- Added SuSEfirewall2 rule and fixed documentation (#335466).
* Tue Aug 07 2007 - sbrabec@suse.cz
- Updated to version 2.2.0:
* New build infrastructure, with shared library.