SHA256
1
0
forked from pool/nut
OBS User unknown 2008-12-18 14:17:48 +00:00 committed by Git OBS Bridge
parent 9ea527824c
commit 6e5669224f
5 changed files with 85 additions and 27 deletions

View File

@ -10,7 +10,7 @@ You have two basic ways to install nut:
- nut-classic - Uses dedicated UPS daemon, which works with all types of
connection, features UPS monitoring and network UPS management.
It is not integraded with desktop power management nad you need
It is not integrated with desktop power management and you need
dedicated tool for monitoring your UPSes.
And two additional packages:
@ -30,7 +30,7 @@ configuration. Otherwise you need to use nut-classic.
nut-classic Configuration
NUT is preconfigured to use a local or remote UPS as far as possible.
NUT is pre-configured to use a local or remote UPS as far as possible.
But it still requires a minimal manual configuration before the first
use.
@ -140,11 +140,11 @@ If you want to configure nut to do suspend to disk instead of shutdown
you should:
- Verify, that suspend to disk works correctly with your desktop:
shutdown -z +0
powersave -U
(You can lose your unsaved data, if your computer does not support
suspend.)
- Change SHUTDOWNCMD in /etc/ups/upsmon.conf to:
SHUTDOWNCMD "/sbin/shutdown -z +0"
SHUTDOWNCMD "/usr/bin/powersave -U"
- Verify, that your UPS provides reasonable grant period to complete
suspend in all situations.

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Wed Dec 17 18:51:44 CET 2008 - sbrabec@suse.cz
- Fixed Suspend to Disc documentation (bnc#449861).
- Support Suspend to Disc in scriptlets.
- Turn UPS down during emergency Suspend to Disc (bnc#449862).
- Fixed locations of pm-utils stuff (bnc#449866).
- upssched-cmd moved to /bin (bnc#449828).
- Fixed incorrect path to upssched-cmd (bnc#449869).
- Fixed files listed twice.
-------------------------------------------------------------------
Tue Dec 9 12:26:59 CET 2008 - ro@suse.de

View File

@ -1,9 +1,16 @@
#!/bin/bash
. /etc/pm/functions
. /usr/lib/pm-utils/functions
case "$1" in
hibernate|suspend)
hibernate)
if test -n "$POWERDOWNFLAG" -a -f "$POWERDOWNFLAG" ; then
export UPSD_POWERDOWN_CONDITION=1
/etc/init.d/upsd try-powerdown
fi
stopservice upsd
;;
suspend)
stopservice upsd
;;
thaw|resume)

View File

@ -28,7 +28,7 @@ Obsoletes: smartups
Conflicts: apcupsd
Summary: Network UPS Tools Core (Unbreakable Power Supply Monitoring)
Version: 2.2.2
Release: 64
Release: 65
Url: http://www.networkupstools.org/
Source: %{name}-%{version}.tar.bz2
Source1: upsd.init
@ -119,7 +119,7 @@ Group: Hardware/UPS
Requires: %{name}-classic = %{version}
Enhances: %{name}-classic
# for update from openSUSE <= 10.3, SLE <= 10
Provides: nut:%{_prefix}/lib/ups/driver/snmp-ups
Provides: nut:%{MODELPATH}/snmp-ups
%description drivers-net
Networking drivers for the Network UPS Tools. You will need them
@ -474,7 +474,9 @@ cp -a %{S:6} 20-nut-disable-hal-hid-ups.fdi
mv upsd-early-powerdown.init upsd-early-powerdown
%patch
%patch3
%if %suse_version < 1110
%patch4
%endif
%if %suse_version < 1030
%patch6 -R
%endif
@ -484,6 +486,10 @@ sed -i "s/@UPSD_USER@/%{USER}/g" upsd.init conf/upsmon.conf.sample
%if %suse_version > 1030
%patch12
%endif
%if %suse_version < 1030
sed -i 's:/usr/lib/pm-utils/functions:/etc/pm/functions:' nut.sleep
%endif
sed -i s:/usr/local/ups/bin:/bin: conf/upssched.conf.sample.in
%build
autoreconf -f -i
@ -524,8 +530,15 @@ cp nut.firewall $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services
%endif
mkdir -p $RPM_BUILD_ROOT%{_datadir}/hal/fdi/policy/20thirdparty
install -m 644 20-nut-disable-hal-hid-ups.fdi $RPM_BUILD_ROOT%{_datadir}/hal/fdi/policy/20thirdparty/
%if %suse_version >= 1030
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/pm-utils/sleep.d
install nut.sleep $RPM_BUILD_ROOT%{_prefix}/lib/pm-utils/sleep.d/99nut
%else
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/pm/sleep.d
install nut.sleep $RPM_BUILD_ROOT%{_sysconfdir}/pm/sleep.d/80nut
install nut.sleep $RPM_BUILD_ROOT%{_sysconfdir}/pm/sleep.d/99nut
%endif
mkdir $RPM_BUILD_ROOT/bin
mv $RPM_BUILD_ROOT%{_bindir}/upssched-cmd $RPM_BUILD_ROOT/bin/upssched-cmd
# Rename web pages to not conflict with apache2-example-pages or user home page:
mkdir $RPM_BUILD_ROOT%{HTMLPATH}/nut $RPM_BUILD_ROOT%{CGIPATH}/nut
mv $RPM_BUILD_ROOT%{HTMLPATH}/*.{html,png} $RPM_BUILD_ROOT%{HTMLPATH}/nut/
@ -541,6 +554,8 @@ bin/chown -R %{USER}:%{GROUP} %{STATEPATH}
%post -n libupsclient1 -p /sbin/ldconfig
%postun -n libupsclient1 -p /sbin/ldconfig
%pre classic
usr/sbin/useradd -r -o -g %{GROUP} -s /bin/false \
-c "UPS daemon" -d /sbin %{USER} 2>/dev/null || :
@ -563,9 +578,20 @@ bin/chmod 600 %{CONFPATH}/upsd.conf %{CONFPATH}/upsmon.conf %{CONFPATH}/upsd.use
if usr/bin/grep -q '^HALT_POWERDOWN_INSERT="\(%{_sysconfdir}/init\.d/upsd try-powerdown\|\)"' etc/sysconfig/shutdown ; then
usr/bin/sed -i 's:^\(HALT_POWERDOWN_INSERT="\).*"[[:space:]]*:\1%{_sysconfdir}/init.d/upsd try-powerdown":' etc/sysconfig/shutdown
else
echo >&2 "nut: WARNING: Unknown value of HALT_POWERDOWN_INSERT in %{_sysconfdir}/sysconfig/shutdown."
echo >&2 " Keeping unchanged. Should be:"
echo >&2 "HALT_POWERDOWN_INSERT=\"%{_sysconfdir}/init.d/upsd try-powerdown\""
# User configured Suspend-to-disc. Keep it unchanged and be silent.
if ! usr/bin/grep -q '^HALT_POWERDOWN_INSERT="/usr/bin/powersave -U' etc/sysconfig/shutdown ; then
echo >&2 "nut: WARNING: Unknown value of HALT_POWERDOWN_INSERT in %{_sysconfdir}/sysconfig/shutdown."
echo >&2 " Keeping unchanged. Should be:"
echo >&2 "HALT_POWERDOWN_INSERT=\"%{_sysconfdir}/init.d/upsd try-powerdown\""
echo >&2 "or"
echo >&2 "HALT_POWERDOWN_INSERT=\"/usr/bin/powersave -U\""
fi
fi
# Migrate Suspend to Disc to the new convention (bnc#449861):
# It was never on by default, but documentation up to 11.0 recommends
# "shutdown -z +0" for suspend to disc. It was discontinued before 11.0.
if fgrep "shutdown -z +0" /etc/ups/upsmon.conf ; then
sed -i 's:/sbin/shutdown -z +0:/usr/bin/powersave -U:;s:shutdown -z +0:/usr/bin/powersave -U:' /etc/ups/upsmon.conf
fi
# Silently remove %{_sysconfdir}/sysconfig/smartups. File is now obsolete and
# values are copied to not replaced config files.
@ -575,14 +601,12 @@ rm -f %{_sysconfdir}/sysconfig/smartups
%preun classic
%{stop_on_removal upsd}
%postun -n libupsclient1 -p /sbin/ldconfig
%postun classic
%{restart_on_update upsd}
# Remove HALT_POWERDOWN_INSERT
if test $1 -eq 0 -a ! -f %{_sysconfdir}/init.d/upsd ; then
if usr/bin/grep -q '^HALT_POWERDOWN_INSERT="%{_sysconfdir}/init\.d/upsd try-powerdown"' etc/sysconfig/shutdown ; then
usr/bin/sed -i 's:^\(HALT_POWERDOWN_INSERT="\)%{_sysconfdir}/init\.d/upsd try-powerdown":\1":' etc/sysconfig/shutdown
if usr/bin/grep -q '^HALT_POWERDOWN_INSERT="\(%{_sysconfdir}/init\.d/upsd try-powerdown\|/usr/bin/powersave -U\)"' etc/sysconfig/shutdown ; then
usr/bin/sed -i 's:^\(HALT_POWERDOWN_INSERT="\)\(%{_sysconfdir}/init\.d/upsd try-powerdown\|/usr/bin/powersave -U\)":\1":' etc/sysconfig/shutdown
else
echo >&2 "nut: WARNING: Unknown value of HALT_POWERDOWN_INSERT in %{_sysconfdir}/sysconfig/shutdown."
echo >&2 " Keeping unchanged. Should be:"
@ -601,23 +625,22 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog MAINTAINERS NEWS README README.SUSE UPGRADING upsd-early-powerdown docs/FAQ docs/*.txt docs/cables
%dir %{_prefix}/lib/ups
%dir %{_prefix}/lib/ups/driver
%{_prefix}/lib/ups/*
%exclude %{_prefix}/lib/ups/driver/snmp-ups
%exclude %{_prefix}/lib/ups/driver/netxml-ups
%{_datadir}/nut
%{_datadir}/hal/fdi/policy/20thirdparty/20-nut-disable-hal-hid-ups.fdi
%doc %{_mandir}/man8/*.*
%exclude %doc %{_mandir}/man8/ups*.*
%exclude %doc %{_mandir}/man8/netxml-ups*.*
%exclude %doc %{_mandir}/man8/snmp-ups*.*
%{MODELPATH}
%attr(700,%{USER},%{GROUP}) %{STATEPATH}
%dir %{MODELPATH}
%{MODELPATH}/*
%exclude %{MODELPATH}/snmp-ups
%exclude %{MODELPATH}/netxml-ups
%files drivers-net
%defattr(-,root,root)
%{_prefix}/lib/ups/driver/snmp-ups
%{_prefix}/lib/ups/driver/netxml-ups
%{MODELPATH}/snmp-ups
%{MODELPATH}/netxml-ups
%doc %{_mandir}/man8/netxml-ups*.*
%doc %{_mandir}/man8/snmp-ups*.*
@ -636,15 +659,20 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) %{CONFPATH}/upsset.conf
%config(noreplace) %{CONFPATH}/upssched.conf
%{_bindir}/*
/bin/*
%doc %{_mandir}/man5/*.*
%doc %{_mandir}/man8/ups*.*
%if %suse_version >= 1030
%{_prefix}/lib/pm-utils/sleep.d/99nut
%else
%{_sysconfdir}/pm/sleep.d/99nut
%endif
%{_sbindir}/*
%{_sysconfdir}/dbus-1/system.d/upsd.conf
%if %suse_version >= 1030
%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/nut
%endif
%{_sysconfdir}/init.d/upsd
%{_sysconfdir}/pm/sleep.d/80nut
%{_sysconfdir}/udev/rules.d/*.rules
%files cgi
@ -668,6 +696,14 @@ rm -rf $RPM_BUILD_ROOT
%doc %{_mandir}/man3/*.*
%changelog
* Wed Dec 17 2008 sbrabec@suse.cz
- Fixed Suspend to Disc documentation (bnc#449861).
- Support Suspend to Disc in scriptlets.
- Turn UPS down during emergency Suspend to Disc (bnc#449862).
- Fixed locations of pm-utils stuff (bnc#449866).
- upssched-cmd moved to /bin (bnc#449828).
- Fixed incorrect path to upssched-cmd (bnc#449869).
- Fixed files listed twice.
* Tue Dec 09 2008 ro@suse.de
- add pre script for classic package to add the user also
before this package is installed

View File

@ -351,9 +351,13 @@ case "$1" in
;;
try-powerdown)
## Special command: Instruct UPS to shutdown, if halt is running
## and power is failing. Otherwise silently quit.
if test "$RUNLEVEL" = "0" -a -n "$POWERDOWNFLAG" -a -f "$POWERDOWNFLAG" ; then
exec $0 powerdown
## or variable UPSD_POWERDOWN_CONDITION is set and power is failing.
## Otherwise silently quit.
##
if test "$RUNLEVEL" = "0" -o -n "$UPSD_POWERDOWN_CONDITION" ; then
if test -n "$POWERDOWNFLAG" -a -f "$POWERDOWNFLAG" ; then
exec $0 powerdown
fi
fi
;;
*)