Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions net/nut/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Copyright (C) 2006-2016 OpenWrt.org
# Copyright (C) 2006-2026 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
Expand All @@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=nut
PKG_VERSION:=2.8.4
PKG_RELEASE:=3
PKG_VERSION:=2.8.5
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://networkupstools.org/source/2.8/
PKG_HASH:=a2fe55bc2d90b4a848d6ff8bac361e6d1c97f899a545219cad707d17a27ff127
PKG_SOURCE_URL:=https://www.networkupstools.org/source/2.8/
PKG_HASH:=18bf32e59eb764b13da3c4fa70384926d7fa584cb31d2fe7f137a570633eeec1
PKG_LICENSE:=GPL-2.0-or-later GPL-3.0-or-later GPL-1.0-or-later Artistic-1.0-Perl
PKG_LICENSE_FILES:=LICENSE-GPL2 LICENSE-GPL3 COPYING
PKG_FIXUP:=autoreconf
Expand Down Expand Up @@ -69,8 +69,12 @@ define Package/nut-server/install
$(INSTALL_DIR) $(1)/etc/nut
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/lib/functions/nut
$(INSTALL_DIR) $(1)/usr/share/nut
$(INSTALL_BIN) ./files/nut-server.init $(1)/etc/init.d/nut-server
$(INSTALL_DATA) ./files/nut-common.sh.functions $(1)/lib/functions/nut/nut-common.sh
$(INSTALL_DATA) ./files/nut-config.sh.functions $(1)/lib/functions/nut/nut-config.sh
$(INSTALL_DATA) ./files/nut-service.sh.functions $(1)/lib/functions/nut/nut-service.sh
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upsd $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/nut/cmdvartab $(1)/usr/share/nut/
$(INSTALL_DIR) $(1)/etc/config
Expand Down Expand Up @@ -383,9 +387,9 @@ define DriverPackage

endef
define Package/nut-driver-$(2)/install
$(INSTALL_DIR) $$(1)/lib/nut
$(CP) $$(PKG_INSTALL_DIR)/lib/nut/$(2) $$(1)/lib/nut/
$(if $(filter $(2),clone),$(CP) $$(PKG_INSTALL_DIR)/lib/nut/$(2)-outlet $$(1)/lib/nut/)
$(INSTALL_DIR) $$(1)/usr/libexec/nut
$(CP) $$(PKG_INSTALL_DIR)/usr/libexec/nut/$(2) $$(1)/usr/libexec/nut/
$(if $(filter $(2),clone),$(CP) $$(PKG_INSTALL_DIR)/usr/libexec/nut/$(2)-outlet $$(1)/usr/libexec/nut/)
endef
endef
define DriverDescription
Expand All @@ -406,7 +410,7 @@ SERIAL_DRIVERLIST = al175 bcmxcp belkin belkinunv bestfcom \
gamatronic genericups isbmex liebert liebert-esp2 liebert-gxe masterguard metasys \
mge-utalk microdowell microsol-apc mge-shut nutdrv_hashx oneac optiups powercom powervar_cx_ser rhino \
safenet nutdrv_siemens-sitop solis tripplite tripplitesu upscode2 victronups powerpanel \
blazer_ser ivtscd apcsmart apcsmart-old riello_ser sms_ser bicker_ser ve-direct \
blazer_ser ivtscd apcsmart apcsmart-old riello_ser sms_ser bicker_ser ve-direct meanwell_ntu \
Comment thread
danielfdickinson marked this conversation as resolved.
nutdrv_qx
SERIAL_DRIVERLIST += nhs_ser
SNMP_DRIVERLIST = snmp-ups
Expand Down Expand Up @@ -527,8 +531,10 @@ $(eval $(call DriverDescription,serial,bicker_ser,\
Driver for Bicker DC UPS via serial port connections))
$(eval $(call DriverDescription,serial,ve-direct,\
Driver for Victron UPS unit running on VE.Direct serial protocol))
$(eval $(call DriverDescription,serial,meanwell_ntu,\
Driver for Mean Well NTU series equipment with serial port))
$(eval $(call DriverDescription,serial,nhs_ser,\
Driver for NHS Nobreaks, senoidal line, with serial port))
Driver for NHS Nobreaks - senoidal line - with serial port))
$(eval $(call DriverDescription,snmp,snmp-ups,\
Multi-MIB Driver for SNMP UPS equipment))
$(eval $(call DriverDescription,usb,usbhid-ups,\
Expand Down Expand Up @@ -556,7 +562,8 @@ CONFIGURE_VARS += \
ac_cv_path_AR=$(TARGET_AR)

CONFIGURE_ARGS += \
--sysconfdir=/etc/nut \
--sysconfdir=/etc \
--with-confdir-suffix=/nut \
--datadir=/usr/share/nut \
--with-dev \
--$(if $(CONFIG_NUT_DRIVER_USB),with,without)-usb \
Expand All @@ -579,7 +586,7 @@ CONFIGURE_ARGS += \
--without-nut_monitor \
--with-statepath=/var/run/nut \
--with-pidpath=/var/run \
--with-drvpath=/lib/nut \
--with-drvpath=/usr/libexec/nut \
--with-user=nut \
--with-group=nut \
$(if $(CONFIG_PACKAGE_nut-web-cgi),--with-gd-includes="`pkg-config --cflags gdlib`") \
Expand Down
6 changes: 4 additions & 2 deletions net/nut/files/30-libhid-ups.head
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ nut_driver_config() {
local cfg="$1"
local nomatch="$2"

config_get runas "$cfg" runas "nut"
. /lib/functions/nut/nut-common.sh
srv_runas

config_get vendorid "$cfg" vendorid
config_get productid "$cfg" productid

[ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && {
chmod 0660 /dev/"$DEVNAME"
chown "${runas:-root}":"$(id -gn "${runas:-root}")" /dev/"$DEVNAME"
chown "${RUNAS:-root}":"$(id -gn "${RUNAS:-root}")" /dev/"$DEVNAME"
}

if [ "$nomatch" = "1" ]; then
Expand Down
15 changes: 11 additions & 4 deletions net/nut/files/nut-cgi.init
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#!/bin/sh /etc/rc.common
# Copyright © 2012 OpenWrt.org
# Copyright © 2012-2026 OpenWrt.org
#
# shellcheck shell=busybox
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

# shellcheck disable=SC2034
Comment thread
danielfdickinson marked this conversation as resolved.
START=87
STOP=23
USE_PROCD=1
Expand Down Expand Up @@ -38,14 +42,17 @@ nut_upscgi_add() {
config_get pass "$cfg" password
system="$upsname@$hostname"
if [ -n "$port" ]; then
system="$system:$port";
system="$system:$port"
fi
config_get displayname "$cfg" displayname
echo "MONITOR $system \"$displayname\"" >> "$UPSCGI_C"
echo "MONITOR $system \"$displayname\"" >>"$UPSCGI_C"
}

service_reload() {
mkdir -m 0755 -p "$(dirname "$UPSCGI_C")"
if [ ! -d "$(dirname "$UPSCGI_C")" ]; then
mkdir -p "$(dirname "$UPSCGI_C")"
chmod 0755 "$(dirname "$UPSCGI_C")"
fi
rm -f "$UPSCGI_C"
rm -f "$UPSCGI_S"

Expand Down
38 changes: 38 additions & 0 deletions net/nut/files/nut-common.sh.functions
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh /etc/rc.common

# Common helper functions for NUT server initscript

# shellcheck shell=ash

# config_load nut_server is already called by sourcing script

# Store path for NUT working data in the global variable STATEPATH
srv_statepath() {
local statepath

config_get statepath upsd statepath /var/run/nut
STATEPATH="$statepath"
}

# Store user under which to run server (upsd) and driver processes in
# global variable 'RUNAS'
srv_runas() {
local runas

[ -n "$RUNAS" ] && return 0

config_get runas upsd runas nut
RUNAS="$runas"
}

prevent_hotplug_restart() {
# Avoid hotplug inadvertently restarting driver during
# forced shutdown

srv_statepath

[ -f /var/run/killpower ] && return 0
if [ -d "${STATEPATH}" ] && [ -f "${STATEPATH}"/disable-hotplug ]; then
return 0
fi
}
Loading
Loading