From: Georgios Kontaxis Date: Sun, 21 Jun 2026 20:08:12 +0000 (+0000) Subject: etherwake: human-readable section name in console output X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=refs%2Fheads%2Fetherwake-simplify-and-document;p=openwrt-packages.git etherwake: human-readable section name in console output Signed-off-by: Georgios Kontaxis --- diff --git a/net/etherwake/files/etherwake.init b/net/etherwake/files/etherwake.init index 14d818873..bb5ed7f34 100644 --- a/net/etherwake/files/etherwake.init +++ b/net/etherwake/files/etherwake.init @@ -67,6 +67,7 @@ do_etherwake() local value='' local password='' local args='' + local section_name='' # password (legacy option) config_get value "${section}" 'password' @@ -79,17 +80,17 @@ do_etherwake() config_get value "${section}" 'secureon' [ -n "${value}" ] && append args "-p ${value}" + # 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 "${initscript}: 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 "${initscript}: Waking up ${section_name} via ${PROGRAM}${args:+ ${args}}" ${PROGRAM} ${args} return $? }