Skip to content

Commit

Permalink
fixes for windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
maurerle committed Jul 18, 2023
1 parent 0523bcc commit 56a73b3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions fritzflash.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,14 @@ def set_ip(ipinterface: IPInterface, network_device: str) -> ContextManager[None
"ipv4",
"add",
"address",
f'"{network_device}" {ipinterface} {ipinterface.netmask}',
f'"{network_device}"',
f"{ipinterface.ip}",
f"{ipinterface.netmask}",
],
capture_output=True,
)
try:
time.sleep(5)
yield output.returncode == 0
finally:
run(
Expand All @@ -140,14 +143,15 @@ def set_ip(ipinterface: IPInterface, network_device: str) -> ContextManager[None
"ipv4",
"delete",
"address",
f'"{network_device}" {ipinterface}',
f'"{network_device}"',
f"{ipinterface.ip}",
],
capture_output=True,
)


def await_online(host: IPAddress):
response = run(["ping", "-c", "1", "-W", f"{INITRAMFS_BOOT_TIMEOUT}", str(host)])
response = run(["ping", "-c", "1", "-w", f"{INITRAMFS_BOOT_TIMEOUT}", str(host)])
return response.returncode


Expand All @@ -157,6 +161,7 @@ def scp_legacy_check() -> bool:
response = run(["ssh", "-V"], capture_output=True)
version_string = response.stderr.decode().strip()
ssh_ver, ssl_ver = version_string.split(",")
ssh_ver = ssh_ver.strip("OpenSSH_for_Windows_")
ssh_ver = ssh_ver.strip("OpenSSH_")
return ssh_ver >= "9.0"

Expand Down Expand Up @@ -245,6 +250,7 @@ def retry_status(current_try, max_try):

def autodiscover_avm_ip():
sender = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
#time.sleep(190.1)
try:
sender.bind(("192.168.178.2", 0))
except OSError as e:
Expand Down Expand Up @@ -658,4 +664,4 @@ def perform_tftp_flash(initramfsfile: Path, sysupgradefile: Path):
time.sleep(30)
perform_bootloader_flash(sysupgradefile, imagefile, flash_tftp)
print("Finished flash procedure")
finish_message()
finish_message()

0 comments on commit 56a73b3

Please sign in to comment.