mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-25 07:31:01 +02:00
scripts: use /sbin/ifconfig where appropriate
BUG=n0ne TEST=cros_au_test_harness Change-Id: Ic26cc191fdb995b091d910f1c8a46e37085fea72 Review URL: http://codereview.chromium.org/6538067
This commit is contained in:
parent
0cb1d1def8
commit
18d5703fd7
@ -107,7 +107,7 @@ function get_hostname {
|
|||||||
# Dedicated usb NIC? Perhaps this detection should be done in the target,
|
# Dedicated usb NIC? Perhaps this detection should be done in the target,
|
||||||
# which will get the return address in one way or another. Or maybe we should
|
# which will get the return address in one way or another. Or maybe we should
|
||||||
# just open a ssh tunnel and use localhost.
|
# just open a ssh tunnel and use localhost.
|
||||||
hostname=$(sudo ifconfig eth0 |
|
hostname=$(/sbin/ifconfig eth0 |
|
||||||
grep 'inet addr' |
|
grep 'inet addr' |
|
||||||
cut -f2 -d':' |
|
cut -f2 -d':' |
|
||||||
cut -f1 -d' ')
|
cut -f1 -d' ')
|
||||||
|
@ -256,7 +256,7 @@ def GetIPAddress(device='eth0'):
|
|||||||
this method gives you a generic way to get the address so you are reachable
|
this method gives you a generic way to get the address so you are reachable
|
||||||
either via a VM or remote machine on the same network.
|
either via a VM or remote machine on the same network.
|
||||||
"""
|
"""
|
||||||
ifconfig_output = RunCommand(['sudo', 'ifconfig', device],
|
ifconfig_output = RunCommand(['/sbin/ifconfig', device],
|
||||||
redirect_stdout=True, print_cmd=False)
|
redirect_stdout=True, print_cmd=False)
|
||||||
match = re.search('.*inet addr:(\d+\.\d+\.\d+\.\d+).*', ifconfig_output)
|
match = re.search('.*inet addr:(\d+\.\d+\.\d+\.\d+).*', ifconfig_output)
|
||||||
if match:
|
if match:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user