diff options
author | Daniel F. Dickinson <cshored@thecshore.com> | 2018-08-02 05:10:18 -0400 |
---|---|---|
committer | Daniel F. Dickinson <cshored@thecshore.com> | 2018-08-02 08:40:12 -0400 |
commit | 98fdf16ecb9c8e24fd7c534cd0696105d472ccbb (patch) | |
tree | 96d5f29ad3c809f9f6d18a5c711b8a179cdfb089 /net | |
parent | db2a4b1be041ab4f09c19418659a000ad1724fed (diff) |
nut: Fix for nut-upsmon without nut-server
nut-monitor failed to create required dir /var/etc/nut, as
well as failing to set appropriate user on the directory and
conf files. Fixing this closes
https://github.com/openwrt/packages/issues/6644
Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/nut/Makefile | 2 | ||||
-rwxr-xr-x | net/nut/files/nut-monitor.init | 22 |
2 files changed, 15 insertions, 9 deletions
diff --git a/net/nut/Makefile b/net/nut/Makefile index 850c4a9fa..2a253f8c0 100644 --- a/net/nut/Makefile +++ b/net/nut/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nut PKG_VERSION:=2.7.4 -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.7/ diff --git a/net/nut/files/nut-monitor.init b/net/nut/files/nut-monitor.init index 388c376ee..af8140781 100755 --- a/net/nut/files/nut-monitor.init +++ b/net/nut/files/nut-monitor.init @@ -126,8 +126,11 @@ nut_upsmon_add() { local password local system - # If no core config, use defaults - [ -r $UPSMON_C ] || nut_upsmon_conf "" + # if UPSMON_C is a symlink we're only doing generated config + [ -L $UPSMON_C ] && { + rm -f $UPSMON_C + nut_upsmon_conf "" + } config_get upsname "$cfg" upsname config_get hostname "$cfg" hostname localhost @@ -143,7 +146,8 @@ nut_upsmon_add() { } start_service() { - rm -f $UPSMON_C + mkdir -p "$(dirname "$UPSMON_C")" + chmod 750 "$(dirname "$UPSMON_C")" config_load nut_monitor @@ -156,20 +160,22 @@ start_service() { chmod 640 $UPSMON_C chmod 640 /var/etc/nut/nut.conf + chown ${runas:-root}:$(id -gn ${runas:-root}) /var/etc/nut + chown ${runas:-root}:$(id -gn ${runas:-root}) /var/etc/nut/nut.conf + chown ${runas:-root}:$(id -gn ${runas:-root}) $UPSMON_C + [ -d /var/run/nut ] || { mkdir -m 0750 -p /var/run/nut chown ${runas:-root}:$(id -gn ${runas:-root}) /var/run/nut } - chown ${runas:-root}:$(id -gn ${runas:-root}) $UPSMON_C - $DEBUG /usr/sbin/upsmon $UPSMON_OPTIONS + exec $DEBUG /usr/sbin/upsmon $UPSMON_OPTIONS } stop_service() { - [ -r $PID_F ] && /usr/sbin/upsmon -c stop - rm -f $UPSMON_C + exec /usr/sbin/upsmon -c stop } reload_service() { - upsmon -c reload + exec /usr/sbin/upsmon -c reload } |