diff options
Diffstat (limited to 'templates/interfaces')
-rw-r--r-- | templates/interfaces/ethernet/node.tag/duplex/node.def | 20 | ||||
-rw-r--r-- | templates/interfaces/ethernet/node.tag/speed/node.def | 19 |
2 files changed, 33 insertions, 6 deletions
diff --git a/templates/interfaces/ethernet/node.tag/duplex/node.def b/templates/interfaces/ethernet/node.tag/duplex/node.def index e7e87ad..92fd6e3 100644 --- a/templates/interfaces/ethernet/node.tag/duplex/node.def +++ b/templates/interfaces/ethernet/node.tag/duplex/node.def @@ -1,9 +1,23 @@ type: txt help: "Set the duplex mode for this interface" -syntax: $(@) in "half", "full"; "duplex must be half or full" -commit: $(../speed) != ""; "if duplex is hardcoded, speed must also be hardcoded" -update: "sudo ethtool -s $(../@) speed $(../speed/@) duplex $(@) autoneg off" +default: "auto" +syntax: $(@) in "auto", "half", "full"; "duplex must be auto, half or full" +commit: exec "if [ x$(@) != xauto ]; then \ + if [ x$(../speed/@) == xauto ]; then \ + exit 1; \ + fi; \ + else \ + if [ x$(../speed/@) != xauto ]; then \ + exit 1; \ + fi; \ + fi; " ; "if duplex is hardcoded, speed must also be hardcoded" +update: "if [ x$(@) != xauto ]; then \ + sudo ethtool -s $(../@) speed $(../speed/@) duplex $(@) autoneg off; \ + else \ + sudo ethtool -s $(../@) autoneg on; \ + fi; " delete: "sudo ethtool -s $(../@) autoneg on" #comp_help:Possible completions: +# auto\t\tAuto negotiation # half\t\tHalf duplex # full\t\tFull duplex diff --git a/templates/interfaces/ethernet/node.tag/speed/node.def b/templates/interfaces/ethernet/node.tag/speed/node.def index 9f983e1..bff2f08 100644 --- a/templates/interfaces/ethernet/node.tag/speed/node.def +++ b/templates/interfaces/ethernet/node.tag/speed/node.def @@ -1,6 +1,19 @@ type: txt help: "Set the speed for this interface" -syntax: $(@) in "10", "100", "1000"; "Speed must be 10, 100, or 1000" -commit: $(../duplex) != ""; "if speed is hardcoded, duplex must also be hardcoded" -update: "sudo ethtool -s $(../@) speed $(@) duplex $(../duplex/@) autoneg off" +default: "auto" +syntax: $(@) in "auto", "10", "100", "1000"; "Speed must be auto, 10, 100, or 1000" +commit: exec "if [ x$(@) != xauto ]; then \ + if [ x$(../duplex/@) == xauto ]; then \ + exit 1; \ + fi; \ + else \ + if [ x$(../duplex/@) != xauto ]; then \ + exit 1; \ + fi; \ + fi;"; "if speed is hardcoded, duplex must also be hardcoded" +update: "if [ x$(@) != xauto ]; then \ + sudo ethtool -s $(../@) speed $(@) duplex $(../duplex/@) autoneg off; \ + else \ + sudo ethtool -s $(../@) autoneg on; \ + fi; " delete: "sudo ethtool -s $(../@) autoneg on" |