mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-30 10:38:55 +00:00
39 lines
813 B
Plaintext
39 lines
813 B
Plaintext
|
##
|
||
|
# Power on the target machine via magic Wake On Lan packets
|
||
|
#
|
||
|
# \param --power-on-wol-mac MAC address of target machine
|
||
|
#
|
||
|
# \param --power-on-wol-dev Outgoing network interface
|
||
|
#
|
||
|
|
||
|
source [genode_dir]/tool/run/amt.inc
|
||
|
|
||
|
|
||
|
proc power_on_wol_mac { } {
|
||
|
return [get_cmd_arg_first --power-on-wol-mac ""]
|
||
|
}
|
||
|
|
||
|
|
||
|
proc power_on_wol_dev { } {
|
||
|
return [get_cmd_arg_first --power-on-wol-dev "eth0"]
|
||
|
}
|
||
|
|
||
|
|
||
|
proc run_power_on { } {
|
||
|
if {[power_on_wol_mac] == ""} {
|
||
|
puts stderr {wake-on-lan MAC address not specified}
|
||
|
exit -1
|
||
|
}
|
||
|
|
||
|
if {![have_installed etherwake]} {
|
||
|
puts stderr {'etherwake' utitity for using wake-on-lan is not installed}
|
||
|
exit -1
|
||
|
}
|
||
|
|
||
|
puts "sending magic WOL packet..."
|
||
|
exec sudo ip link set [power_on_wol_dev] up
|
||
|
exec sudo etherwake -i [power_on_wol_dev] [power_on_wol_mac]
|
||
|
|
||
|
return true
|
||
|
}
|