From 0623bea7b1137b32b28811d6279b6aef10f6ded40fdd6155fb7c4919a17274b6 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Thu, 9 Aug 2007 23:24:28 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/nut?expand=0&rev=4 --- nut-2.0.4-overflow.patch | 33 ----- nut-2.0.4-setcmd-literal.patch | 11 -- nut-2.0.4.tar.bz2 | 3 - nut-2.2.0.tar.bz2 | 3 + nut-notifyflag.patch | 4 +- nut-pkgconfig.patch | 85 ++++++++++++ nut-powersave.patch | 4 +- nut-preconfig.patch | 36 ++--- nut.changes | 13 ++ nut.spec | 231 ++++++++++++++++++--------------- upsd.init | 18 +-- 11 files changed, 247 insertions(+), 194 deletions(-) delete mode 100644 nut-2.0.4-overflow.patch delete mode 100644 nut-2.0.4-setcmd-literal.patch delete mode 100644 nut-2.0.4.tar.bz2 create mode 100644 nut-2.2.0.tar.bz2 create mode 100644 nut-pkgconfig.patch diff --git a/nut-2.0.4-overflow.patch b/nut-2.0.4-overflow.patch deleted file mode 100644 index ba89cb4..0000000 --- a/nut-2.0.4-overflow.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- drivers/newhidups.c -+++ drivers/newhidups.c -@@ -578,7 +578,7 @@ - - void upsdrv_initups(void) - { -- char *regex_array[5]; -+ char *regex_array[6]; - int r; - int i; - ---- drivers/rhino.h -+++ drivers/rhino.h -@@ -59,7 +59,7 @@ - /* data vetor from received and configuration data package - not used yet - unsigned char Dados[ 161 ]; */ - /* identification group */ --char Model[12]; -+char Model[15]; - int RhinoModel; /*, imodel; */ - int PotenciaNominal, PowerFactor; - /* input group */ ---- drivers/tripplite_usb.c -+++ drivers/tripplite_usb.c -@@ -1038,7 +1038,7 @@ - */ - void upsdrv_initups(void) - { -- char *regex_array[5]; -+ char *regex_array[6]; - int r; - - #if 0 diff --git a/nut-2.0.4-setcmd-literal.patch b/nut-2.0.4-setcmd-literal.patch deleted file mode 100644 index 3805d50..0000000 --- a/nut-2.0.4-setcmd-literal.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- drivers/gamatronic.c -+++ drivers/gamatronic.c -@@ -125,7 +125,7 @@ - void sec_setinfo(int varnum, char *value) - { - -- if (sec_varlist[varnum].setcmd != ""){ -+ if (*sec_varlist[varnum].setcmd){/*Not empty*/ - - if (sec_varlist[varnum].flags == FLAG_STRING) { - dstate_setinfo(sec_varlist[varnum].setcmd,"%s", value); diff --git a/nut-2.0.4.tar.bz2 b/nut-2.0.4.tar.bz2 deleted file mode 100644 index eea85ec..0000000 --- a/nut-2.0.4.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bae249bd862bcd28c7e3760b0205267ec94fe8785c0bdd3cdd9b43f3f7551a73 -size 547224 diff --git a/nut-2.2.0.tar.bz2 b/nut-2.2.0.tar.bz2 new file mode 100644 index 0000000..3909864 --- /dev/null +++ b/nut-2.2.0.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d32850de66aed8c078d47392113db153587bdd21f57f892fe3468a7f58acd5b2 +size 893144 diff --git a/nut-notifyflag.patch b/nut-notifyflag.patch index 9f5da6e..68d4179 100644 --- a/nut-notifyflag.patch +++ b/nut-notifyflag.patch @@ -1,5 +1,5 @@ ---- conf/upsmon.conf -+++ conf/upsmon.conf +--- conf/upsmon.conf.sample ++++ conf/upsmon.conf.sample @@ -243,6 +243,15 @@ # IGNORE - Don't do anything # diff --git a/nut-pkgconfig.patch b/nut-pkgconfig.patch new file mode 100644 index 0000000..d3506c2 --- /dev/null +++ b/nut-pkgconfig.patch @@ -0,0 +1,85 @@ +--- configure.in ++++ configure.in +@@ -39,10 +39,6 @@ + cgiexecdir='${exec_prefix}/cgi-bin' + driverexecdir='${exec_prefix}/bin' + htmldir='${prefix}/html' +-pkgcfgdir='/usr/lib/pkgconfig' +-if test ! -d "${pkgcfgdir}"; then +- pkgcfgdir='' +-fi + hotplugdir='/etc/hotplug' + if test ! -d "${hotplugdir}"; then + hotplugdir='' +@@ -635,35 +631,6 @@ + ]) + + +-AC_MSG_CHECKING(whether to enable pkg-config support) +-AC_ARG_WITH(pkgconfig-dir, +- AC_HELP_STRING([--with-pkgconfig-dir=PATH], [where to install pkg-config *.pc files (/usr/lib/pkgconfig)]), +- [ +- case "${withval}" in +- yes) +- if test -z "${pkgcfgdir}"; then +- AC_MSG_RESULT(no) +- AC_MSG_ERROR(["pkg-config directory requested but not found]) +- fi +- ;; +- auto) +- ;; +- no) +- pkgcfgdir="" +- ;; +- *) +- pkgcfgdir="${withval}" +- ;; +- esac +- ], +- ) +-if test -n "${pkgcfgdir}"; then +- AC_MSG_RESULT(using ${pkgcfgdir}) +-else +- AC_MSG_RESULT(no) +-fi +-AM_CONDITIONAL(WITH_PKG_CONFIG, test -n "${pkgcfgdir}") +- + AC_MSG_CHECKING(whether to install hotplug rules) + AC_ARG_WITH(hotplug-dir, + AC_HELP_STRING([--with-hotplug-dir=PATH], [where to install hotplug rules (/etc/hotplug)]), +--- lib/Makefile.am ++++ lib/Makefile.am +@@ -1,8 +1,7 @@ + # Network UPS Tools: lib + + if WITH_LIB +-if WITH_PKG_CONFIG +- pkgcfg_DATA = libupsclient.pc +-endif ++pkgconfig_DATA = libupsclient.pc ++pkgconfigdir = $(libdir)/pkgconfig + bin_SCRIPTS = libupsclient-config + endif +--- lib/libupsclient-config.in ++++ lib/libupsclient-config.in +@@ -10,8 +10,8 @@ + Version="@PACKAGE_VERSION@" + prefix=@prefix@ + exec_prefix=@exec_prefix@ +-Libs="-L@libdir@ -lupsclient @SSL_LDFLAGS@" +-Cflags="-I@includedir@ @SSL_CFLAGS@" ++Libs="-L@libdir@ -lupsclient @LIBSSL_LDFLAGS@" ++Cflags="-I@includedir@ @LIBSSL_CFLAGS@" + + case "$1" in + +--- lib/libupsclient.pc.in ++++ lib/libupsclient.pc.in +@@ -9,5 +9,5 @@ + Name: libupsclient + Description: UPS monitoring with Network UPS Tools + Version: @PACKAGE_VERSION@ +-Libs: -L${libdir} -lupsclient @SSL_LDFLAGS@ +-Cflags: -I${includedir} @SSL_CFLAGS@ ++Libs: -L${libdir} -lupsclient @LIBSSL_LDFLAGS@ ++Cflags: -I${includedir} @LIBSSL_CFLAGS@ diff --git a/nut-powersave.patch b/nut-powersave.patch index 1ee80cc..3c71dca 100644 --- a/nut-powersave.patch +++ b/nut-powersave.patch @@ -1,5 +1,5 @@ ---- conf/upsmon.conf -+++ conf/upsmon.conf +--- conf/upsmon.conf.sample ++++ conf/upsmon.conf.sample @@ -130,6 +130,8 @@ # Example: # NOTIFYCMD /usr/local/ups/bin/notifyme diff --git a/nut-preconfig.patch b/nut-preconfig.patch index 8e61b0a..8bd03ac 100644 --- a/nut-preconfig.patch +++ b/nut-preconfig.patch @@ -1,33 +1,13 @@ ---- conf/Makefile.in -+++ conf/Makefile.in -@@ -17,14 +17,14 @@ - - install: - @for f in $(SECFILES) ; do \ -- $(INSTALLCMD) -m 0600 $$f $(CONFPATH)/$$f.sample; \ -+ $(INSTALLCMD) -m 0600 $$f $(CONFPATH)/$$f; \ - done - - @for f in $(PUBFILES) ; do \ -- $(INSTALLCMD) -m 0644 $$f $(CONFPATH)/$$f.sample; \ -+ $(INSTALLCMD) -m 0644 $$f $(CONFPATH)/$$f; \ - done - - install-cgi-conf: - @for f in $(CGIPUB) ; do \ -- $(INSTALLCMD) -m 0644 $$f $(CONFPATH)/$$f.sample; \ -+ $(INSTALLCMD) -m 0644 $$f $(CONFPATH)/$$f; \ - done ---- conf/hosts.conf -+++ conf/hosts.conf +--- conf/hosts.conf.sample ++++ conf/hosts.conf.sample @@ -27,3 +27,5 @@ # MONITOR myups@localhost "Local UPS" # MONITOR su2200@10.64.1.1 "Finance department" # MONITOR matrix@shs-server.example.edu "Sierra High School data room #1" + +MONITOR myups@localhost "Local UPS" ---- conf/ups.conf -+++ conf/ups.conf +--- conf/ups.conf.sample ++++ conf/ups.conf.sample @@ -102,3 +102,8 @@ # # To find out if your driver supports any extra settings, start it with @@ -37,8 +17,8 @@ + driver = undefined + port = /dev/undefined + desc = "Local UPS" ---- conf/upsd.users -+++ conf/upsd.users +--- conf/upsd.users.sample ++++ conf/upsd.users.sample @@ -68,3 +68,13 @@ # The matching MONITOR line in your upsmon.conf would look like this: # @@ -53,8 +33,8 @@ + password = @UPSD_INITIAL_SLAVE_PASSWORD@ + allowfrom = localhost + upsmon slave ---- conf/upsmon.conf -+++ conf/upsmon.conf +--- conf/upsmon.conf.sample ++++ conf/upsmon.conf.sample @@ -21,13 +21,13 @@ # user, since it creates an opportunity for an attack by changing the # SHUTDOWNCMD to something malicious. diff --git a/nut.changes b/nut.changes index 76d799d..27c04b4 100644 --- a/nut.changes +++ b/nut.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Tue Aug 7 19:08:04 CEST 2007 - sbrabec@suse.cz + +- Updated to version 2.2.0: + * New build infrastructure, with shared library. + * Support for HAL and Plug and Play. + * New drivers. + * Support for many new devices. + * IPv6 support. + * Client commands now defaults to localhost. + * Driver improvements. + * Documentation improvements. + ------------------------------------------------------------------- Wed May 16 21:32:29 CEST 2007 - olh@suse.de diff --git a/nut.spec b/nut.spec index 5f48c20..3bf7928 100644 --- a/nut.spec +++ b/nut.spec @@ -1,5 +1,5 @@ # -# spec file for package nut (Version 2.0.4) +# spec file for package nut (Version 2.2.0) # # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -11,23 +11,18 @@ # norootforbuild Name: nut -BuildRequires: apache2-devel gd-devel libusb-devel net-snmp-devel openssl-devel tcpd-devel -%if %suse_version > 1000 -BuildRequires: dbus-1 -%endif -License: GNU General Public License (GPL) +BuildRequires: apache2-devel dbus-1-devel gd-devel hal-devel libopenssl-devel libusb-devel net-snmp-devel openssl-devel pkg-config tcpd-devel +License: GPL v2 or later Group: Hardware/UPS Provides: smartups -Requires: /usr/bin/pgrep /usr/bin/pkill /usr/bin/grep /usr/bin/fgrep /usr/sbin/lsusb /usr/bin/readlink -%if %suse_version > 1000 +Requires: %{_bindir}/pgrep %{_bindir}/pkill %{_bindir}/grep %{_bindir}/fgrep %{_sbindir}/lsusb %{_bindir}/readlink Requires: powersave -%endif Obsoletes: smartups Conflicts: apcupsd Autoreqprov: on Summary: UPS Monitoring Software -Version: 2.0.4 -Release: 59 +Version: 2.2.0 +Release: 1 URL: http://www.networkupstools.org/ Source: %{name}-%{version}.tar.bz2 Source1: upsd.init @@ -35,16 +30,16 @@ Source2: README.SUSE Source3: upsd-early-powerdown.init Source4: upsd.dbus-1 Patch: nut-preconfig.patch -Patch1: %{name}-%{version}-overflow.patch Patch3: nut-notifyflag.patch Patch4: nut-powersave.patch -Patch5: %{name}-%{version}-setcmd-literal.patch +Patch5: nut-pkgconfig.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build -PreReq: %insserv_prereq /bin/chown /bin/chmod /usr/bin/fgrep /usr/bin/grep /usr/bin/sed /usr/bin/head /usr/bin/md5sum -%define apache_serverroot %(/usr/sbin/apxs2 -q datadir 2>/dev/null || /usr/sbin/apxs -q PREFIX) +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 CGIPATH %{apache_serverroot}/cgi-bin -%define MODELPATH /usr/lib/ups/driver -%define STATEPATH /var/lib/ups +%define HTMLPATH %{apache_serverroot}/htdocs +%define MODELPATH %{_prefix}/lib/ups/driver +%define STATEPATH %{_localstatedir}/lib/ups %define CONFPATH %{_sysconfdir}/ups %define USER upsd @@ -89,75 +84,93 @@ Authors: Arjen de Korte Fabio Di Niro +%{_datadir}/doc/packages/nut/README. +%package devel +Summary: UPS Monitoring Software +Group: Hardware/UPS +Requires: %{name} = %{version} + +%description devel +This is a developing project to monitor a large assortment of UPS +hardware. Many models have ports on the back to allow other devices to +check the status. If it gives basic information about the power and +battery status, it can probably be supported without too much +difficulty. More advanced features on the higher-end models are also +supported to allow tracking of values over time such as temperature and +voltage. + +Network communications are used so that multiple systems can monitor a +single physical UPS and shut down together if necessary without any +special "sharing hardware" on the UPS itself. Detailed information +about supported hardware can be found in +/usr/share/doc/packages/nut/README. + + +_=====_ + + +- APC Smart-UPS, Back-UPS Pro, Matrix-UPS, Belkin Regulator Pro, + Best Power Fortress, Fortress (FOR), Fortress Telecom (FTC), + Patriot Pro (PRO), Patriot Pro II (PR2), Engetron Jr, Fenton + Technologies PowerPal, PowerOn, PowerPure, Effekta MI/MT/MH + models (2502 cable), PowerGuard PG-600, IPT Anzen, MGE Pulsar, + MGE Pulsar/Comet/Galaxy, Mustek Electronics, Opti-UPS, Advice + Partner/King, PowerCom, Toshiba 1500 series, Trust (KingPro) + 425/625, Microdowell BBox, IMV/Victron + +- Many models that use the same basic principle to communicate with the +computer. See generic-ups.txt in /usr/share/doc/packages/nut for more +information, including a list of supported equipment. + + + +Authors: +-------- + Russell Kroll + Arnaud Quette + Arjen de Korte + Fabio Di Niro + +%{_datadir}/doc/packages/nut/README. %prep -%setup +%setup -q cp -a %{S:1} %{S:2} %{S:3} %{S:4} . mv upsd-early-powerdown.init upsd-early-powerdown %patch -%patch1 %patch3 -%if %suse_version > 1000 %patch4 -%endif %patch5 -USB_IDS=$(sed -n 1000 -mkdir -p $RPM_BUILD_ROOT/etc/dbus-1/system.d -install -m 644 upsd.dbus-1 $RPM_BUILD_ROOT/etc/dbus-1/system.d/upsd.conf -%endif +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 %pre -# 2>/dev/null usr/sbin/useradd -r -o -g daemon -s /bin/false \ -c "UPS daemon" -d /sbin %USER 2>/dev/null || : @@ -177,19 +190,17 @@ 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 %suse_version > 1000 -if usr/bin/grep -q '^HALT_POWERDOWN_INSERT="\(/etc/init\.d/upsd try-powerdown\|\)"' etc/sysconfig/shutdown ; then - usr/bin/sed -i 's:^\(HALT_POWERDOWN_INSERT="\).*"[[:space:]]*:\1/etc/init.d/upsd try-powerdown":' etc/sysconfig/shutdown +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 /etc/sysconfig/shutdown." + 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=\"/etc/init.d/upsd try-powerdown\"" + echo >&2 "HALT_POWERDOWN_INSERT=\"%{_sysconfdir}/init.d/upsd try-powerdown\"" fi -%endif -# Silently remove /etc/sysconfig/smartups. File is now obsolete and +# Silently remove %{_sysconfdir}/sysconfig/smartups. File is now obsolete and # values are copied to not replaced config files. -# /etc/sysconfig/smartups was last present in SuSE Linux 10.0 -rm -f /etc/sysconfig/smartups +# %{_sysconfdir}/sysconfig/smartups was last present in SuSE Linux 10.0 +rm -f %{_sysconfdir}/sysconfig/smartups %preun %{stop_on_removal upsd} @@ -197,20 +208,18 @@ rm -f /etc/sysconfig/smartups %postun %{restart_on_update upsd} # Remove HALT_POWERDOWN_INSERT -%if %suse_version > 1000 -if test $1 -eq 0 -a ! -f /etc/init.d/upsd ; then - if usr/bin/grep -q '^HALT_POWERDOWN_INSERT="/etc/init\.d/upsd try-powerdown"' etc/sysconfig/shutdown ; then - usr/bin/sed -i 's:^\(HALT_POWERDOWN_INSERT="\)/etc/init\.d/upsd try-powerdown":\1":' etc/sysconfig/shutdown +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 else - echo >&2 "nut: WARNING: Unknown value of HALT_POWERDOWN_INSERT in /etc/sysconfig/shutdown." + 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=\"\"" fi - if test -f /etc/init.d/upsd-early-powerdown ; then - echo >&2 "nut: WARNING: You may want to remove your /etc/init.d/upsd-early-powerdown." + if test -f %{_sysconfdir}/init.d/upsd-early-powerdown ; then + echo >&2 "nut: WARNING: You may want to remove your %{_sysconfdir}/init.d/upsd-early-powerdown." fi fi -%endif %insserv_cleanup %clean @@ -218,9 +227,19 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) -%doc docs/ CHANGES COPYING CREDITS INSTALL MAINTAINERS NEWS README README.SUSE UPGRADING upsd-early-powerdown -%doc %{_mandir}/man8/* -%doc %{_mandir}/man5/* +%doc AUTHORS COPYING ChangeLog MAINTAINERS NEWS README README.SUSE UPGRADING upsd-early-powerdown docs/FAQ docs/*.txt docs/cables +%{_sysconfdir}/init.d/upsd +%{_sysconfdir}/dbus-1/system.d/upsd.conf +%{_sysconfdir}/udev/rules.d/*.rules +%dir %{_prefix}/lib/ups +%{_bindir}/* +%exclude %{_bindir}/*-config +%{_datadir}/nut +%{_libdir}/*.so.* +%doc %{_mandir}/man8/*.* +%doc %{_mandir}/man5/*.* +%{_sbindir}/* +%{CGIPATH}/*.cgi %dir %{CONFPATH} %config(noreplace) %{CONFPATH}/hosts.conf %config(noreplace) %attr(600,%{USER},root) %{CONFPATH}/upsd.conf @@ -231,23 +250,31 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) %{CONFPATH}/upssched.conf %config(noreplace) %{CONFPATH}/upsstats-single.html %config(noreplace) %{CONFPATH}/upsstats.html -/etc/init.d/upsd -%if %suse_version > 1000 -/etc/dbus-1/system.d/upsd.conf -%endif -%dir %attr(700,%{USER},nogroup) %{STATEPATH} -%dir /usr/lib/ups +%{HTMLPATH}/*.html +%{HTMLPATH}/*.png %{MODELPATH} -/usr/bin/* -/usr/sbin/* -%dir /usr/share/nut -/usr/share/nut/* -%{CGIPATH}/upsimage.cgi -%{CGIPATH}/upsstats.cgi -%{CGIPATH}/upsset.cgi -%attr(700,%{USER},root) %STATEPATH +%attr(700,%{USER},uucp) %{STATEPATH} + +%files devel +%defattr(-,root,root) +%{_bindir}/*-config +%{_includedir}/*.h +%{_libdir}/*.so +%{_libdir}/*.*a +%{_libdir}/pkgconfig/*.pc +%doc %{_mandir}/man3/*.* %changelog +* Tue Aug 07 2007 - sbrabec@suse.cz +- Updated to version 2.2.0: + * New build infrastructure, with shared library. + * Support for HAL and Plug and Play. + * New drivers. + * Support for many new devices. + * IPv6 support. + * Client commands now defaults to localhost. + * Driver improvements. + * Documentation improvements. * Wed May 16 2007 - olh@suse.de - Buildrequires libusb -> libusb-devel * Tue Feb 20 2007 - mvaner@suse.cz diff --git a/upsd.init b/upsd.init index e51cf56..d6d1496 100644 --- a/upsd.init +++ b/upsd.init @@ -149,24 +149,16 @@ case "$1" in if test -n "$UPS_OWNER" ; then PORTS=$(sed -n 's/^[[:space:]][[:space:]]*port[[:space:]]*=[[:space:]]*//p' < $UPS_CONFIG) - ## Change permissions of devices. + ## Change permissions of undetectable ports (for detectable ports it's done by udev). for PORT in $PORTS ; do - if test "$PORT" = auto ; then - PORT=$(LANG=C LC_ALL=C lsusb | grep '\(@USB_IDS@\)' | sed 's:^:/dev/bus/usb/:;s/Bus //;s/ Device /\//;s/: .*//') - if test -z "$PORT" ; then - echo -n "$0: no device for \"port = auto\" in $UPS_CONFIG" - rc_failed 1 ; rc_status -v ; rc_exit - fi - fi if test -L "$PORT" ; then PORT=$(readlink -f $PORT) fi - if test -n "$PORT" && test -c "$PORT" ; then + case "$PORT" in + /dev/ttyS* ) chown $UPS_OWNER $PORT || { rc_failed ; rc_status -v ; rc_exit ; } - else - echo -n "$0: invalid $PORT in $UPS_CONFIG" - rc_failed 2 ; rc_status -v ; rc_exit - fi + ;; + esac done fi