From e30e934272f16e3fa60454c37692034064a33a5c Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Tue, 1 Oct 2024 10:14:48 +0200 Subject: src: replace DEVICE env variable with get_ethernet_interface() Use a python function to obtain the main net interface. Detect the first ethernet inferface in use. Stop using the DEVICE environment variable. --- src/live/ogOperations.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/live/ogOperations.py') diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index 2f59711..48bb1ee 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -24,7 +24,7 @@ from src.live.parttypes import get_parttype from src.utils.image import * from src.utils.postinstall import configure_os -from src.utils.net import ethtool +from src.utils.net import * from src.utils.menu import generate_menu from src.utils.fs import * from src.utils.probe import os_probe, get_cache_dev_path @@ -343,7 +343,7 @@ class OgLiveOperations: f.truncate(0) def _poweroff_oglive(self, operation='poweroff'): - interface = os.getenv('DEVICE') + interface = get_ethernet_interface() cmd_ethtool = shlex.split(f'ethtool -s {interface} wol g') cmd_browser = shlex.split('pkill -9 browser') if shutil.which('busybox'): @@ -772,7 +772,7 @@ class OgLiveOperations: cache = get_cache_dev_path() disks = get_disks() - interface = os.getenv('DEVICE') + interface = get_ethernet_interface() link = ethtool(interface) json_body = { 'serial_number': '', 'disk_setup': [], -- cgit v1.2.3-18-g5258