Skip to content

Commit bd4b4d8

Browse files
committed
etherwake: human-readable section name in console output
Signed-off-by: Georgios Kontaxis <geko1702+commits@99rst.org>
1 parent fc632a1 commit bd4b4d8

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

net/etherwake/files/etherwake.init

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ do_etherwake()
6565
local value=''
6666
local password=''
6767
local args=''
68+
local section_name=''
6869

6970
# password (legacy option)
7071
config_get value "${section}" 'password'
@@ -77,17 +78,18 @@ do_etherwake()
7778
config_get value "${section}" 'secureon'
7879
[ -n "${value}" ] && append args "-p ${value}"
7980

81+
# name
82+
config_get section_name "${section}" 'name'
83+
[ -z "${section_name}" ] && section_name="${section}"
84+
8085
# mac address
8186
config_get value "${section}" 'mac'
82-
[ -z "${value}" ] && { echo "${initscript}: Target ${section} has no MAC address"; return 1; }
87+
[ -z "${value}" ] && {
88+
echo "Target '${section_name}' has no 'mac' address"; return 1; }
8389
append args "${value}"
8490

85-
# name
86-
config_get value "${section}" 'name'
87-
[ -z "${value}" ] && value="{section}"
88-
8991
# execute command
90-
echo "${initscript}: Waking up ${value} via ${PROGRAM}${args:+ ${args}}"
92+
echo "Waking up '${section_name}' via ${PROGRAM}${args:+ ${args}}"
9193
${PROGRAM} ${args}
9294
return $?
9395
}

0 commit comments

Comments
 (0)