- fix #249028 - usb udev rules

- update initscript and sysconfig file
- fix calls to open() for compatibility with the new glibc
This commit is contained in:
Tomas Smetana 2007-08-16 10:31:13 +00:00
commit eb2ea751d5
5 changed files with 59 additions and 35 deletions

22
nut-2.2.0-glibcopen.patch Normal file
View file

@ -0,0 +1,22 @@
--- nut-2.2.0/drivers/megatec_usb.c.open 2007-08-16 09:32:03.000000000 +0200
+++ nut-2.2.0/drivers/megatec_usb.c 2007-08-16 09:32:24.000000000 +0200
@@ -209,7 +209,7 @@
/* link the matchers */
regex_matcher->next = &subdriver_matcher;
- ret = usb->open(&udev, &hiddevice, regex_matcher, NULL, MODE_NOHID);
+ ret = (usb->open)(&udev, &hiddevice, regex_matcher, NULL, MODE_NOHID);
if (ret < 0)
usb_open_error(port);
--- nut-2.2.0/drivers/libhid.c.open 2007-08-16 09:28:05.000000000 +0200
+++ nut-2.2.0/drivers/libhid.c 2007-08-16 09:28:23.000000000 +0200
@@ -589,7 +589,7 @@
}
/* get and parse descriptors (dev, cfg and report) */
- ReportSize = comm_driver->open(udevp, hd, matcher, ReportDesc, mode);
+ ReportSize = (comm_driver->open)(udevp, hd, matcher, ReportDesc, mode);
if (ReportSize == -1)
return NULL;

10
nut-2.2.0-udevusb.patch Normal file
View file

@ -0,0 +1,10 @@
--- nut-2.2.0/scripts/udev/nut-usbups.rules.in.udevusb 2007-08-15 13:25:38.000000000 +0200
+++ nut-2.2.0/scripts/udev/nut-usbups.rules.in 2007-08-15 13:25:50.000000000 +0200
@@ -1,6 +1,6 @@
# udev rules for the NUT USB drivers
-SUBSYSTEM!="usb_device", GOTO="nut-usbups_rules_end"
+SUBSYSTEM!="usb", GOTO="nut-usbups_rules_end"
ACTION!="add", GOTO="nut-usbups_rules_end"
# MGE UPS SYSTEMS - usbhid-ups

View file

@ -9,9 +9,9 @@
Summary: Network UPS Tools
Name: nut
Version: 2.2.0
Release: 1.1%{?dist}
Release: 2%{?dist}
Group: Applications/System
License: GPL
License: GPLv2+
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Url: http://www.networkupstools.org/
Source: http://www.networkupstools.org/source/2.0/%{name}-%{version}.tar.gz
@ -20,6 +20,8 @@ Source2: ups.sysconfig
Patch0: nut-2.2.0-conf.patch
Patch1: nut-2.2.0-multilib.patch
Patch2: nut-2.2.0-udevusb.patch
Patch3: nut-2.2.0-glibcopen.patch
Requires: nut-client => 2.0.0 hal dbus-glib
Requires(post): fileutils /sbin/chkconfig /sbin/service
@ -86,6 +88,8 @@ necessary to develop NUT client applications.
%setup -q
%patch0 -p1 -b .conf
%patch1 -p1 -b .multilib
%patch2 -p1 -b .udevusb
%patch3 -p1 -b .open
%build
%configure \
@ -105,8 +109,6 @@ necessary to develop NUT client applications.
--disable-static
make %{?_smp_mflags}
make %{?_smp_mflags} snmp
make %{?_smp_mflags} usb
%install
rm -rf %{buildroot}
@ -275,6 +277,11 @@ rm -rf %{buildroot}
%{_libdir}/pkgconfig/libupsclient.pc
%changelog
* Wed Aug 15 2007 Tomas Smetana <tsmetana@redhat.com> 2.2.0-2
- fix #249028 - usb udev rules
- update initscript and sysconfig file
- fix calls to open() for compatibility with the new glibc
* Fri Jul 13 2007 Tomas Smetana <tsmetana@redhat.com> 2.2.0-1.1
- rebuild

View file

@ -25,28 +25,24 @@ fi
start() {
if [ "$SERVER" = "yes" ]; then
# Exit if server = yes and model = NONE (not configured)
if [ "$MODEL" = "NONE" ]; then
exit 0
fi
echo -n $"Starting $MODEL: "
if [ "$MODEL" = "upsdrvctl" ]; then
daemon /sbin/upsdrvctl start
else
daemon /sbin/$MODEL $OPTIONS $DEVICE
fi
echo -n $"Starting UPS driver controller: "
daemon /sbin/upsdrvctl start
RETVAL=$?
echo
prog="upsd"
echo -n $"Starting $prog: "
daemon /usr/sbin/upsd $UPSD_OPTIONS
RETVAL=$?
if [ "$RETVAL" = 0 ]; then
RETVAL=$?
fi
echo
echo -n $"Starting UPS monitor (master): "
daemon /usr/sbin/upsmon
if [ "$RETVAL" = 0 ]; then
RETVAL=$?
fi
echo
else
echo -n $"Starting UPS monitor (slave): "
@ -122,7 +118,11 @@ case "$1" in
status)
if [ "$SERVER" = "yes" ]; then
if [ "$MODEL" = "upsdrvctl" ]; then
/sbin/upsdrvctl -v status
# show status of each configured driver
for MYMODEL in $(egrep '^[[:space:]]*driver' /etc/ups/ups.conf \
| sed 's/.*=[[:space:]]*//'); do
status $MYMODEL
done
else
status $MODEL
fi

View file

@ -1,23 +1,8 @@
# If the UPS is locally attached set it to "yes"
SERVER=yes
# Model of the UPS (filename to call for it, without path)
# Example - one of
# apcsmart - APC SMartUPS and similar
# optiups
# bestups
# genericups
# ups-trust425+625
# upsdrvctl
# You MUST change this, or set SERVER to "no"
# To support multiple drivers, set MODEL=upsdrvctl
MODEL=NONE
# UPS device - needed if UPS is locally attached
DEVICE=/dev/ttyS0
# Any options to pass to $MODEL
# ex. for my TrippLite UPS, use
# OPTIONS="-t 5"
OPTIONS=
# Any options to pass to upsd
UPSD_OPTIONS=
# This *must* be the same as in /etc/ups/upsmon.conf
POWERDOWNFLAG=/etc/killpower
#
# [End]