sysstat: Update init script
authorJeffery To <redacted>
Tue, 12 Feb 2019 06:57:40 +0000 (14:57 +0800)
committerJeffery To <redacted>
Tue, 12 Feb 2019 06:57:40 +0000 (14:57 +0800)
This replaces the use of uci_validate_section() with
uci_load_validate(), which removes the need to declare local variables
for every config option.

Signed-off-by: Jeffery To <redacted>
utils/sysstat/Makefile
utils/sysstat/files/sysstat.init

index a7278a03e9cd0c6cf2d2cca41563bdd58474b4a2..45e5529baf122af3b82e83ecc68ec9ffc4b65fa3 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=sysstat
 PKG_VERSION:=12.0.2
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_LICENSE:=GPL-2.0
 PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr>
index a8190008dae41ff4e4cdd37759c85cadb1083ae7..9975d5ea601b5576d933708b7b80e6245929bac5 100755 (executable)
@@ -9,7 +9,7 @@ PROG=/usr/lib/sysstat/sadc
 SYSSTAT_CFG="/etc/sysstat/sysstat"
 
 validate_sysstat_section() {
-       uci_validate_section sysstat sysstat "${1}" \
+       uci_load_validate sysstat sysstat "$1" "$2" \
                'log_history:uinteger' \
                'compressafter:uinteger' \
                'sadc_options:string' \
@@ -18,11 +18,8 @@ validate_sysstat_section() {
                'enabled:string'
 }
 
-start_service() {
-
-       local log_history compressafter sadc_options sa_dir zip enabled
-
-       validate_sysstat_section sysstat || {
+start_sysstat_instance() {
+       [ "$2" = 0 ] || {
                echo "validation failed"
                return 1
        }
@@ -42,6 +39,10 @@ start_service() {
        procd_close_instance
 }
 
+start_service() {
+       validate_sysstat_section sysstat start_sysstat_instance
+}
+
 service_triggers()
 {
        procd_add_reload_trigger "sysstat"
git clone https://git.99rst.org/PROJECT