mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
Merge pull request #7799 from cshoredaniel/pr-nut-runas-backport
[18.06] nut: Default to run as root but fix alt runas
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=nut
|
PKG_NAME:=nut
|
||||||
PKG_VERSION:=2.7.4
|
PKG_VERSION:=2.7.4
|
||||||
PKG_RELEASE:=8
|
PKG_RELEASE:=9
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.7/
|
PKG_SOURCE_URL:=http://www.networkupstools.org/source/2.7/
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ nut_upsmon_conf() {
|
|||||||
|
|
||||||
echo "# Config file automatically generated from UCI config" > "$UPSMON_C"
|
echo "# Config file automatically generated from UCI config" > "$UPSMON_C"
|
||||||
|
|
||||||
config_get runas "$cfg" runas "nut"
|
config_get runas "$cfg" runas
|
||||||
[ -n "$runas" ] && echo "RUN_AS_USER $runas" >> $UPSMON_C
|
[ -n "$runas" ] && echo "RUN_AS_USER $runas" >> $UPSMON_C
|
||||||
|
|
||||||
config_get val "$cfg" minsupplies 1
|
config_get val "$cfg" minsupplies 1
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ upsd_runas() {
|
|||||||
|
|
||||||
[ -n "$RUNAS" ] && return
|
[ -n "$RUNAS" ] && return
|
||||||
|
|
||||||
config_get runas "$cfg" runas "nut"
|
config_get runas "$cfg" runas
|
||||||
RUNAS="$runas"
|
RUNAS="$runas"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ upsd_config() {
|
|||||||
|
|
||||||
# Note runas support requires you make sure USB device file is readable by
|
# Note runas support requires you make sure USB device file is readable by
|
||||||
# the runas user
|
# the runas user
|
||||||
config_get runas "$cfg" runas "nut"
|
config_get runas "$cfg" runas
|
||||||
RUNAS="$runas"
|
RUNAS="$runas"
|
||||||
|
|
||||||
config_get statepath "$cfg" statepath "/var/run/nut"
|
config_get statepath "$cfg" statepath "/var/run/nut"
|
||||||
@@ -221,7 +221,7 @@ build_global_driver_config() {
|
|||||||
get_write_driver_config "$cfg" retrydelay
|
get_write_driver_config "$cfg" retrydelay
|
||||||
get_write_driver_config "$cfg" pollinterval
|
get_write_driver_config "$cfg" pollinterval
|
||||||
get_write_driver_config "$cfg" synchronous
|
get_write_driver_config "$cfg" synchronous
|
||||||
config_get runas "$cfg" user "nut"
|
config_get runas "$cfg" user
|
||||||
RUNAS="$runas"
|
RUNAS="$runas"
|
||||||
upsd_runas
|
upsd_runas
|
||||||
|
|
||||||
@@ -229,7 +229,6 @@ build_global_driver_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build_config() {
|
build_config() {
|
||||||
local RUNAS=nut
|
|
||||||
local STATEPATH=/var/run/nut
|
local STATEPATH=/var/run/nut
|
||||||
|
|
||||||
mkdir -m 0755 -p "$(dirname "$UPS_C")"
|
mkdir -m 0755 -p "$(dirname "$UPS_C")"
|
||||||
@@ -252,7 +251,7 @@ start_driver_instance() {
|
|||||||
local requested="$2"
|
local requested="$2"
|
||||||
local driver
|
local driver
|
||||||
local STATEPATH=/var/run/nut
|
local STATEPATH=/var/run/nut
|
||||||
local RUNAS=nut
|
local RUNAS
|
||||||
|
|
||||||
[ "$havedriver" != 1 ] && return
|
[ "$havedriver" != 1 ] && return
|
||||||
|
|
||||||
@@ -301,6 +300,7 @@ start_server_instance() {
|
|||||||
start_service() {
|
start_service() {
|
||||||
local havedriver haveserver
|
local havedriver haveserver
|
||||||
local STATEPATH=/var/run/nut
|
local STATEPATH=/var/run/nut
|
||||||
|
local RUNAS
|
||||||
|
|
||||||
# Avoid hotplug inadvertenly restarting driver during
|
# Avoid hotplug inadvertenly restarting driver during
|
||||||
# forced shutdown
|
# forced shutdown
|
||||||
|
|||||||
Reference in New Issue
Block a user