Commit Graph

85 Commits

Author SHA1 Message Date
Paul Doran 82f36e0c78 nut: update to 2.8.1
Signed-off-by: Paul Doran <ruralroots@gmail.com>
[remove upstream patch included in 2.8.1]
2023-12-18 19:28:17 +02:00
Paul Fertser 0c10c224be treewide: remove AUTORELEASE
Automatically compute and substitute current values for all
$(AUTORELEASE) instances as this feature is deprecated and shouldn't be
used.

The following temporary change was made to the core:

diff --git a/rules.mk b/rules.mk
index 57d7995d4fa8..f16367de87a8 100644
--- a/rules.mk
+++ b/rules.mk
@@ -429,7 +429,7 @@ endef
 abi_version_str = $(subst -,,$(subst _,,$(subst .,,$(1))))

 COMMITCOUNT = $(if $(DUMP),0,$(call commitcount))
-AUTORELEASE = $(if $(DUMP),0,$(call commitcount,1))
+AUTORELEASE = $(if $(DUMP),0,$(shell sed -i "s/\$$(AUTORELEASE)/$(call commitcount,1)/" $(CURDIR)/Makefile))

 all:
 FORCE: ;

And this command used to fix affected packages:

for i in $(cd feeds/packages; git grep -l PKG_RELEASE:=.*AUTORELEASE | \
                              sed 's^.*/\([^/]*\)/Makefile^\1^';);
do
  make package/$i/download
done

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
2023-04-21 22:46:58 +02:00
Eneas U de Queiroz fbcedc003e nut: ensure time_t is defined in upsclient.h
Use an upstream commit to ensure time_t is defined in upsclient.h,
fixing a compile failure in collectd.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
2022-09-17 12:54:11 -07:00
Eneas U de Queiroz 1d3e666fbe nut: avoid picking up libi2c dependency
Add --without-linux-i2c to configure arguments to avoid using i2c if
found in the staging dir.

Switch to AUTORELEASE.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
2022-09-17 12:54:11 -07:00
Eric Luehrsen f5c0f8297d nut: update to 2.8.0
-- Release Message Snippet https://networkupstools.org/ --
After a long and windy trip since the last official release v2.7.4 half
a dozen years ago ... NUT v2.8.0! ... the new release includes numerous
new drivers, sub-drivers, protocols and bug-fixes, with many companies
and individuals chipping in with contributions of code. ...

Signed-off-by: Eric Luehrsen <ericluehrsen@gmail.com>
2022-09-10 22:40:10 -04:00
Rob J. Epping 67e49b7e0e nut: add cable type nut driver config
at least driver apcsmart-old (maybe more) allow for specifying the
type of cable used. My old UPS does will not function when cable type
is not specified.

This will add support for configuration option 'cable'

Signed-off-by: Rob J. Epping <epping@renf.us>
2022-05-13 06:53:27 +02:00
Sergey V. Lobanov 43372343ee nut: fix build on macos
nut build fails on macos due to:
1. configure script can not use AR env var due to OpenWrt build
system provides only executable name (e.g. aarch64-openwrt-linux-musl-gcc-ar)
but configure script checks if AR has '/'. As a result, configure
script ignores AR env var and uses system `ar` but macos `ar` is
not compatible with the objects generated by OpenWrt GCC toolchain.

This commit explicitly sets ac_cv_path_AR=$(TARGET_AR) to use
OpenWrt toolchain AR.

2. configure script detects if build host is macos and adds
macosx_ups driver as a build target, but this driver can not be
build with OpenWrt toolchain because OpenWrt is Linux.

This commit explicitly disables macosx_ups driver using configure
flag --without-macosx_ups

Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
2022-01-31 13:57:36 -08:00
Pascal Coudurier f9bbc5173c nut: refactor upssched uci-defaults script
Add checks not to overwrite defaultnotify options in the nut-sendmail-notify fashion.
Use lists for defaultnotify instead of option.
Add check not to overwrite notifycmd if already defined.
upssched-cmd script must not be called directly, it is called by the upssched binary with needed arguments.

Signed-off-by: Pascal Coudurier <coudu@wanadoo.fr>
2022-01-11 16:27:19 -08:00
Pascal Coudurier 0f91594e2a nut: refactor nut-monitor uci config file
Convert notifyflags options to lists as supported by the init script, so multiple options can be chosen.
Add SYSLOG default option to individuals notifyflags instead of deprecated flag 1|0.
Add comment for defaultnotify and individuals notifyflags about possible values.

Signed-off-by: Pascal Coudurier <coudu@wanadoo.fr>
2022-01-11 16:27:19 -08:00
Pascal Coudurier a46fd908df nut: fix typo in nut-monitor init script
This fixes a typo in the nut-monitor init script when building config file from uci config.

Signed-off-by: Pascal Coudurier <coudu@wanadoo.fr>
2022-01-11 16:27:19 -08:00
Seb Belcher ff68df2faa nut: Add the option to compile Nut NetXML drivers with the Nut package.
Also modifies the nut-server init script to include options specific to the netxml driver.

Signed-off-by: Seb Belcher <sdjbelcher@gmail.com>
2021-09-23 13:03:10 -07:00
Rosen Penev db6a4f797f nut: fix compilation with GCC11
nut is a C++98 project which does not compile with GCC11's default of
C++17.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-07-07 14:52:31 -07:00
Sven Roederer f25f49a8b7 nut: fix typo in nutshutdown script
Even it's only cosmetic and should not affect the function of regular system,
fix the name of the IPKG_INSTROOT variable.
Typo was added long ago with 8400c9a6ec.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
2021-04-03 18:38:13 -07:00
Rosen Penev 4d39346fb4
nut: fix _ handling
Taken from https://github.com/openwrt/packages/issues/13359

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-09-19 16:52:58 -07:00
Daniel F. Dickinson 290ab508ab treewide: Remove myself as maintainer
Life changes, I'm no longer avaiable to be an sufficiently active
OpenWrt developer.  Therefore removing myself from maintainer from
all packages I maintained in OpenWrt.

All the best for those who keep up the good work!

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2020-03-20 14:12:55 -04:00
Matt Merhar 0b04dd34a0 nut: fix other/otherflag custom variables in nut-server.init
This allows custom config parameters to be added to the generated config
files, enabling the original intended functionality per
https://openwrt.org/docs/guide-user/services/ups/software.nut.

Example usage from /etc/config/nut_server:

config driver 'apc'
	option driver 'snmp-ups'
	option snmp_version 'v3'
	option port '172.16.100.5'
	list other 'secLevel'
	list other 'secName'
	list other 'authPassword'
	list otherflag 'notransferoids'

config other 'other_secLevel'
	option value 'authNoPriv'

config other 'other_secName'
	option value 'some_username'

config other 'other_authPassword'
	option value 'some_password'

config other 'otherflag_notransferoids'
	option value '1'

Signed-off-by: Matt Merhar <mattmerhar@protonmail.com>
2020-01-19 22:39:44 -05:00
Sebastian Kemper 7d4f1b8589 nut: update OpenSSL 1.1.0 patch
Replaces OpenWrt patch with upstream patch. Also removes
0002-Fix-check-for-empty-string.patch as this is included in upstream
OpenSSL 1.1.0 patch.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2019-11-27 19:52:30 +01:00
Sebastian Kemper cdd660a41d nut: fix CGI setup
This commit makes

 - the libgd dependency (as well as specifying libs and includes)
 - the configure argument "--with-cgi"

dependant on whether the package nut-web-cgi is selected.

nut-web-cgi is also added to PKG_CONFIG_DEPENDS.

Resolves: #10641

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2019-11-27 19:42:54 +01:00
Sebastian Kemper a08cc5b533 nut: revert 81e6bb7
gdlib pc file doesn't set a version, so "pkg-config --modversion gdlib"
returns nothing. Also, the test

  if test "$?" != "0" -a -n "${GD_VERSION}"; then

is wrong as pkg-config wouldn't return != 0 on success.

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2019-11-26 21:16:47 +01:00
Jeffery To 53e1692ae9 treewide: Use default PKG_BUILD_DIR when possible
This removes lines that set PKG_BUILD_DIR when the set value is no
different from the default value.

Specifically, the line is removed if the assigned value is:

* $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)

  The default PKG_BUILD_DIR was updated[1] to incorporate BUILD_VARIANT
  if it is set, so now this is identical to the default value.

* $(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR)

  if PKG_SOURCE_SUBDIR is set to $(PKG_NAME)-$(PKG_VERSION), making it
  the same as the previous case

* $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

  This is the same as the default PKG_BUILD_DIR when there is no
  BUILD_VARIANT.

* $(BUILD_DIR)/[name]-$(PKG_VERSION)

  where [name] is a string that is identical to PKG_NAME

[1]: https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=e545fac8d968864a965edb9e50c6f90940b0a6c9

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
2019-10-13 02:01:34 +08:00
Rosen Penev 81e6bb77cf
nut: Switch to pkgconfig for finding libgd
nut uses gdlib-config to find libgd, which happens to be deprecated. This
switches it to use pkgconfig and allows a fallback to gdlib-config, same
as the libusb check.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-09-13 12:56:43 -07:00
Sven Eckelmann bbb1ea7345 treewide: Change .*GPL.*+ licenses to SPDX compatible identifier
The CONTRIBUTING.md requests an (or multiple) SPDX identifier for GPL
licenses. But a lot of packages did use a different, non-SPDX style with a
"+" at the end instead of "-or-later".

Signed-off-by: Sven Eckelmann <sven@narfation.org>
2019-09-10 07:45:15 +02:00
Daniel F. Dickinson c25b751041 nut: Actually do FSD when required
The code was all there but the call do the function containing it was missing,
so call the function so that forced (UPS) shutdown occurs on a battery critical
or manually requested FSD situation.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2019-04-28 20:44:15 +00:00
Daniel F. Dickinson 867ea959a2 nut: Fix nutmon issues with init
NUT's upsmon is rather peculiar in that it has a child process that runs as
a regular user and a parent process that runs as root (in order to facilitate
shutting down the device if needed).  procd doesn't deal well with this and
doing 'normal' procd stop / restart / etc results in the child process still
hanging around but with not parent, which causes undesired behaviour.  Therefore,
add the use of 'upsmon -c stop' during process shutdown / restart in order to
ensure that upsmon is actually fully stopped.

Also fixes nut-monitor going into crashloop on network changes (due to
trigger that restarted upsmon but failed due to orphan child from before
restart).

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2019-04-28 20:17:12 +00:00
Daniel F. Dickinson d7db15459f nut: initscripts hotplug: Fix many small semantic issues
Small but important tweaks to fix the operation of the nut initscripts
and hotplug scripts.  All hail shellcheck and proofreading and
dogfooding.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2019-01-20 12:16:28 -05:00
Hannu Nyman 882b497753
Merge pull request #7910 from cshoredaniel/pr-nut-fsd-bug
nut: Prevent FSD when not specifically requested
2019-01-13 09:45:43 +02:00
Daniel F. Dickinson cb06f02504 nut: Prevent FSD when not specifically requested
Under certain circumstances nutshutdown was causing a forced
shutdown of the UPS even though killpower was not indicated.
Prevent that.  Also clarify the logic for powering off server
by avoiding && || chains.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2019-01-08 04:07:01 -05:00
Daniel F. Dickinson c8cc504efe nut: Fix procd crashloop no interfaces
Fix a crashloop under procd when attempting to bind
to any address when no interfaces are yet available.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2019-01-07 02:03:31 -05:00
Daniel F. Dickinson 89effa4a84 nut: Bump PKG_RELEASE
Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-12-23 00:26:03 -05:00
Daniel F. Dickinson 2d87aa40c8 nut: really run upsd as non-root
One local removal was missed in last push of this fix, so
in certain circumstances upsd would run as root even when
it shouldn't.

Fixes f48b060fa7 ("nut: Fix upsd runs as root")
Closes: #6697 (properly)

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-12-23 00:25:39 -05:00
Daniel F. Dickinson f916a7e0eb nut: Update server config comment 'docs'
Update the commented out settings in /etc/config/nut_server that
shows the available sections with their default settings.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-12-23 00:24:37 -05:00
Daniel F. Dickinson 23c4235554 nut: Fix additional (other) variable handling
There was a cut & paste error in the handling of 'other'
variables (i.e. driver variables not specifically known
to the package but which some users may require to be add).
There was also a logic error from not switching sufficient
after cut & paste.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-12-20 23:24:00 -05:00
Daniel F. Dickinson d04f2580b1 nut: Remove extraneous config reads
Handling of driver variable defaults, overrides, and additional
(other) variables changed and left behind some extraneous
config reads (config_get and config_list_foreach).  Remove those.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-12-20 23:23:56 -05:00
Daniel F. Dickinson 97c7ef6c4d nut: alphabetize driver options
There are a lot of options; to make development easier
alphabetize them.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-12-20 23:23:50 -05:00
Daniel F. Dickinson a5d06ce110 nut: Optionally set serial USB to NUT user
When using serial-port based UPSes with NUT, it is handy to be able to
configure a USB serial port to have be set tot the NUT runas user, so
that NUT can access the serial port automagically.
Closes #6997

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-12-06 03:31:47 -05:00
Daniel F. Dickinson f48b060fa7 nut: Fix upsd runs as root
Closes #6997 - Allows upsd to runas a non-privileged user.
If any driver is running as non-privileged user, the last driver's
user will be used as the server non-privileged user, otherwise the
user specified in config upsd, otherwise nut. Previously the
localisation of RUNAS variable was in the wrong locations.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-12-06 03:02:29 -05:00
Daniel F. Dickinson 192b0f1646 nut: Fix a typo in setting a driver parameter
synchronous would not get set due to typo.  Fixed.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-12-06 00:06:53 -05:00
Daniel F. Dickinson 3aa67b3ca3 nut: Bump PKG_RELEASE
Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-11-19 16:41:53 -05:00
Daniel F. Dickinson 36fd59dc78 nut: Fix extraneous config_get
nut-server initscript had a duplicate config_get statepath, so remove it

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-11-19 16:41:32 -05:00
Daniel F. Dickinson 58e33b02a8 nut: Fix nut-cgi config creation (startup)
Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-11-19 16:41:18 -05:00
Daniel F. Dickinson 44e57d4bdf nut: Fix variables for NUT drivers
Avoid specifying variables that are not specificy set in order to avoid breaking
drivers for which those variables do not exist.  Closes: #7096.

As part of these fixes make sure we have all the variables we need.  Closes: #7001.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-11-19 16:40:49 -05:00
Daniel F. Dickinson 3b5a8eee84 nut: Various startup fixes for monitor and server
Various path and permissions fixes to properly allow nut-server and nut-monitor to
start properly.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-11-19 16:40:39 -05:00
Daniel F. Dickinson 8ff6a83a54 nut: Build serial drivers by default
Serial drivers don't add much to main NUT and appear to be common,
so make it possible for users to use NUT with serial UPS drivers without
a custom build.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-11-19 16:40:11 -05:00
Daniel F. Dickinson 0a49d0ffbb nut: Fix checking for path before it exists
The mechanism for making sure hotplug doesn't execute during forced shutdown
was interfering with initial start of hotplug script due to checking for path
that doesn't exist at initial start.  This fixes that and closes #6966.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-11-19 16:39:53 -05:00
Daniel F. Dickinson daa974cff0 nut: Fix undetected UPS hardware
Leading zeroes left in ProductId results in some UPS hardware not being matched
by the hotplug script lead to bad permissions and driver not starting.

Closes: #6966
Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-11-19 16:39:39 -05:00
Daniel F. Dickinson 2e624f9833 nut: bump PKG_RELEASE
Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-08-29 00:35:05 -04:00
Daniel F. Dickinson 1b6dbe7a7b nut: Remove duplicate/extraneous lines
Removes a duplicate directory creation and a stray newline.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-08-29 00:35:05 -04:00
Daniel F. Dickinson df6beaa2ea nut: Makefile: Fix typo in description
Cosmetic edit.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-08-29 00:35:05 -04:00
Daniel F. Dickinson 461393810d nut: Use quotes around filenames
Avoid potential issues with space or other strangeness by
quoting filenames through the initscripts.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-08-29 00:35:01 -04:00
Daniel F. Dickinson 01b7ea91a1 nut: Fix license information
The source code has multiple licenses so update SPD-X header.

NB: The previously unlisted licenses are not applicable to parts
actually built in any configuration for OpenWrt, but rather to
unused (by us) source code.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2018-08-29 00:17:23 -04:00