Merge pull request #7591 from cshoredaniel/pr-nut-upsd-root
nut: Fix upsd runs as root
This commit is contained in:
commit
9c615edbd4
2 changed files with 12 additions and 1 deletions
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||
|
||||
PKG_NAME:=nut
|
||||
PKG_VERSION:=2.7.4
|
||||
PKG_RELEASE:=10
|
||||
PKG_RELEASE:=11
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.7/
|
||||
|
|
|
@ -38,6 +38,16 @@ upsd_statepath() {
|
|||
STATEPATH="$statepath"
|
||||
}
|
||||
|
||||
upsd_runas() {
|
||||
local cfg="$1"
|
||||
local runas
|
||||
|
||||
[ -n "$RUNAS" ] && return
|
||||
|
||||
config_get runas "$cfg" runas "nut"
|
||||
RUNAS="$runas"
|
||||
}
|
||||
|
||||
listen_address() {
|
||||
local cfg="$1"
|
||||
|
||||
|
@ -213,6 +223,7 @@ build_global_driver_config() {
|
|||
get_write_driver_config "$cfg" synchronous
|
||||
config_get runas "$cfg" user "nut"
|
||||
RUNAS="$runas"
|
||||
upsd_runas
|
||||
|
||||
echo "" >>$UPS_C
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue