This commit is contained in:
committed by
Git OBS Bridge
parent
0623bea7b1
commit
124f4eaa72
13
README.SUSE
13
README.SUSE
@@ -34,7 +34,7 @@ It requires only few adoptions before you can start the service:
|
|||||||
|
|
||||||
* Configuration of a UPS connected to a remote machine:
|
* 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
|
- Comment out or remove the [myups] section at the end of the
|
||||||
file.
|
file.
|
||||||
|
|
||||||
@@ -55,10 +55,21 @@ MONITOR myups@remote_machine 1 upsslave remote_password slave
|
|||||||
the remote machine.
|
the remote machine.
|
||||||
- Change the description as you want.
|
- 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:
|
In the remote /etc/ups/upsd.users:
|
||||||
- Find the line allowfrom for upsslave user.
|
- Find the line allowfrom for upsslave user.
|
||||||
- Add your local machine name to the allowfrom list.
|
- 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:
|
Start the service:
|
||||||
- "/etc/init.d/upsd start" on both local and remote machines.
|
- "/etc/init.d/upsd start" on both local and remote machines.
|
||||||
- If you have edited configuration of a running server, run
|
- If you have edited configuration of a running server, run
|
||||||
|
16
nut-udev.patch
Normal file
16
nut-udev.patch
Normal 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"
|
||||||
|
|
@@ -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
|
Tue Aug 7 19:08:04 CEST 2007 - sbrabec@suse.cz
|
||||||
|
|
||||||
|
17
nut.firewall.in
Normal file
17
nut.firewall.in
Normal 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=""
|
46
nut.spec
46
nut.spec
@@ -19,20 +19,22 @@ Requires: %{_bindir}/pgrep %{_bindir}/pkill %{_bindir}/grep %{_bindir}/fgr
|
|||||||
Requires: powersave
|
Requires: powersave
|
||||||
Obsoletes: smartups
|
Obsoletes: smartups
|
||||||
Conflicts: apcupsd
|
Conflicts: apcupsd
|
||||||
Autoreqprov: on
|
AutoReqProv: on
|
||||||
Summary: UPS Monitoring Software
|
Summary: UPS Monitoring Software
|
||||||
Version: 2.2.0
|
Version: 2.2.0
|
||||||
Release: 1
|
Release: 28
|
||||||
URL: http://www.networkupstools.org/
|
Url: http://www.networkupstools.org/
|
||||||
Source: %{name}-%{version}.tar.bz2
|
Source: %{name}-%{version}.tar.bz2
|
||||||
Source1: upsd.init
|
Source1: upsd.init
|
||||||
Source2: README.SUSE
|
Source2: README.SUSE
|
||||||
Source3: upsd-early-powerdown.init
|
Source3: upsd-early-powerdown.init
|
||||||
Source4: upsd.dbus-1
|
Source4: upsd.dbus-1
|
||||||
|
Source5: nut.firewall.in
|
||||||
Patch: nut-preconfig.patch
|
Patch: nut-preconfig.patch
|
||||||
Patch3: nut-notifyflag.patch
|
Patch3: nut-notifyflag.patch
|
||||||
Patch4: nut-powersave.patch
|
Patch4: nut-powersave.patch
|
||||||
Patch5: nut-pkgconfig.patch
|
Patch5: nut-pkgconfig.patch
|
||||||
|
Patch6: nut-udev.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
PreReq: %insserv_prereq /bin/chown /bin/chmod %{_bindir}/fgrep %{_bindir}/grep %{_bindir}/sed %{_bindir}/head %{_bindir}/md5sum
|
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)
|
%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 STATEPATH %{_localstatedir}/lib/ups
|
||||||
%define CONFPATH %{_sysconfdir}/ups
|
%define CONFPATH %{_sysconfdir}/ups
|
||||||
%define USER upsd
|
%define USER upsd
|
||||||
|
%define GROUP daemon
|
||||||
|
|
||||||
%description
|
%description
|
||||||
This is a developing project to monitor a large assortment of UPS
|
This is a developing project to monitor a large assortment of UPS
|
||||||
@@ -134,13 +137,16 @@ Authors:
|
|||||||
%{_datadir}/doc/packages/nut/README.
|
%{_datadir}/doc/packages/nut/README.
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%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
|
mv upsd-early-powerdown.init upsd-early-powerdown
|
||||||
%patch
|
%patch
|
||||||
%patch3
|
%patch3
|
||||||
%patch4
|
%patch4
|
||||||
%patch5
|
%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
|
%build
|
||||||
autoreconf -f -i
|
autoreconf -f -i
|
||||||
@@ -154,8 +160,13 @@ autoreconf -f -i
|
|||||||
--with-statepath=%{STATEPATH}\
|
--with-statepath=%{STATEPATH}\
|
||||||
--with-drvpath=%{MODELPATH}\
|
--with-drvpath=%{MODELPATH}\
|
||||||
--with-user=%{USER}\
|
--with-user=%{USER}\
|
||||||
--with-group=uucp
|
--with-group=%{GROUP}
|
||||||
make %{?jobs:-j%jobs}
|
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
|
%install
|
||||||
make DESTDIR=$RPM_BUILD_ROOT 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}
|
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
|
||||||
install -m 755 upsd.init $RPM_BUILD_ROOT%{_sysconfdir}/init.d/upsd
|
install -m 755 upsd.init $RPM_BUILD_ROOT%{_sysconfdir}/init.d/upsd
|
||||||
ln -sf ../..%{_sysconfdir}/init.d/upsd $RPM_BUILD_ROOT%{_sbindir}/rcupsd
|
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
|
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
|
install -m 644 upsd.dbus-1 $RPM_BUILD_ROOT%{_sysconfdir}/dbus-1/system.d/upsd.conf
|
||||||
rename .sample "" $RPM_BUILD_ROOT%{_sysconfdir}/ups/*.sample
|
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
|
%pre
|
||||||
usr/sbin/useradd -r -o -g daemon -s /bin/false \
|
usr/sbin/useradd -r -o -g %{GROUP} -s /bin/false \
|
||||||
-c "UPS daemon" -d /sbin %USER 2>/dev/null || :
|
-c "UPS daemon" -d /sbin %{USER} 2>/dev/null || :
|
||||||
|
|
||||||
%post
|
%post
|
||||||
%{fillup_and_insserv -f -n upsd}
|
%{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
|
usr/bin/sed -i s/@UPSD_INITIAL_SLAVE_PASSWORD@/$UPSD_INITIAL_SLAVE_PASSWORD/ %{CONFPATH}/upsd.users
|
||||||
fi
|
fi
|
||||||
# Be sure that all files are owned by a dedicated user.
|
# Be sure that all files are owned by a dedicated user.
|
||||||
bin/chown -R %USER:root %STATEPATH
|
bin/chown -R %{USER}:root %{STATEPATH}
|
||||||
bin/chown %USER:root %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users
|
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
|
bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.users
|
||||||
# Install HALT_POWERDOWN_INSERT
|
# Install HALT_POWERDOWN_INSERT
|
||||||
if usr/bin/grep -q '^HALT_POWERDOWN_INSERT="\(%{_sysconfdir}/init\.d/upsd try-powerdown\|\)"' etc/sysconfig/shutdown ; then
|
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
|
%files
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%doc AUTHORS COPYING ChangeLog MAINTAINERS NEWS README README.SUSE UPGRADING upsd-early-powerdown docs/FAQ docs/*.txt docs/cables
|
%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}/init.d/upsd
|
||||||
%{_sysconfdir}/dbus-1/system.d/upsd.conf
|
%{_sysconfdir}/dbus-1/system.d/upsd.conf
|
||||||
%{_sysconfdir}/udev/rules.d/*.rules
|
%{_sysconfdir}/udev/rules.d/*.rules
|
||||||
@@ -253,7 +271,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{HTMLPATH}/*.html
|
%{HTMLPATH}/*.html
|
||||||
%{HTMLPATH}/*.png
|
%{HTMLPATH}/*.png
|
||||||
%{MODELPATH}
|
%{MODELPATH}
|
||||||
%attr(700,%{USER},uucp) %{STATEPATH}
|
%attr(700,%{USER},%{GROUP}) %{STATEPATH}
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
@@ -263,8 +281,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_libdir}/*.*a
|
%{_libdir}/*.*a
|
||||||
%{_libdir}/pkgconfig/*.pc
|
%{_libdir}/pkgconfig/*.pc
|
||||||
%doc %{_mandir}/man3/*.*
|
%doc %{_mandir}/man3/*.*
|
||||||
|
|
||||||
%changelog
|
%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
|
* Tue Aug 07 2007 - sbrabec@suse.cz
|
||||||
- Updated to version 2.2.0:
|
- Updated to version 2.2.0:
|
||||||
* New build infrastructure, with shared library.
|
* New build infrastructure, with shared library.
|
||||||
|
Reference in New Issue
Block a user