Removed absolute paths for eww network script
This commit is contained in:
parent
098e16e000
commit
65a39a7cd6
@ -92,7 +92,7 @@ class Interface:
|
||||
def get_first_hop() -> IPAddress | None:
|
||||
"""Get the first network hop."""
|
||||
# Use ping to get the first hop
|
||||
cmd = ["/usr/bin/ping", "-c1", "-W0.3", "-t1", "1.1.1.1"]
|
||||
cmd = ["ping", "-c1", "-W0.3", "-t1", "1.1.1.1"]
|
||||
result = run(cmd, stdout=PIPE, stderr=PIPE)
|
||||
try:
|
||||
ip = IPAddress(result.stdout.decode("utf-8").split("\n")[1].split()[1])
|
||||
@ -145,14 +145,14 @@ def interface_status(interface: str, gw):
|
||||
|
||||
|
||||
def ping(host: IPAddress) -> bool:
|
||||
cmd = ["/usr/bin/ping", "-c1", "-w1", str(host)]
|
||||
cmd = ["ping", "-c1", "-w1", str(host)]
|
||||
result = run(cmd, stdout=DEVNULL, stderr=DEVNULL)
|
||||
return result.returncode == 0
|
||||
|
||||
|
||||
def get_public_ip():
|
||||
"""Get the public IP address."""
|
||||
cmd = ["/usr/bin/curl", "-s", "https://ipinfo.io"]
|
||||
cmd = ["curl", "-s", "https://ipinfo.io"]
|
||||
result = run(cmd, stdout=PIPE, stderr=PIPE)
|
||||
try:
|
||||
data = json.loads(result.stdout.decode("utf-8"))
|
||||
@ -171,7 +171,7 @@ def get_public_ip():
|
||||
|
||||
def get_default_route():
|
||||
"""Get the default route."""
|
||||
cmd = ["/usr/bin/ip", "route", "show", "default"]
|
||||
cmd = ["ip", "route", "show", "default"]
|
||||
result = run(cmd, stdout=PIPE, stderr=PIPE)
|
||||
try:
|
||||
# Get first line (might have multiple gateway routes)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user