]> git.99rst.org Git - openwrt-packages.git/commitdiff
etherwake: human-readable section name in console output
authorGeorgios Kontaxis <redacted>
Sun, 21 Jun 2026 20:08:12 +0000 (20:08 +0000)
committerGeorgios Kontaxis <redacted>
Fri, 31 Jul 2026 07:26:39 +0000 (07:26 +0000)
Log 'name' when referring to a configuration 'target'.

Signed-off-by: Georgios Kontaxis <redacted>
net/etherwake/files/etherwake.init

index 1958785b5357d7eac59a14b1600f4c561c9540ab..1ca4cc6e672cbf3eaa312e55c46ef8ae65357a0f 100644 (file)
@@ -65,6 +65,7 @@ do_etherwake()
        local value=''
        local password=''
        local args=''
+       local section_name=''
 
        # password (legacy option)
        config_get value "${section}" 'password'
@@ -80,17 +81,18 @@ do_etherwake()
                append args "-p ${password}"
        fi
 
+       # name
+       config_get section_name "${section}" 'name'
+       [ -z "${section_name}" ] && section_name="${section}"
+
        # mac address
        config_get value "${section}" 'mac'
-       [ -z "${value}" ] && { echo "${initscript}: Target ${section} has no MAC address"; return 1; }
+       [ -z "${value}" ] && {
+               echo "Target '${section_name}' has no 'mac' address"; return 1; }
        append args "${value}"
 
-       # name
-       config_get value "${section}" 'name'
-       [ -z "${value}" ] && value="{section}"
-
        # execute command
-       echo "${initscript}: Waking up ${value} via ${PROGRAM}${args:+ ${args}}"
+       echo "Waking up '${section_name}' via ${PROGRAM}${args:+ ${args}}"
        ${PROGRAM} ${args}
        return $?
 }
git clone https://git.99rst.org/PROJECT