Predictable Network Interface Names support

This commit is contained in:
Félix Aime 2021-01-19 17:25:06 +01:00
parent 2cfc3baf75
commit e88996cb0c
2 changed files with 4 additions and 4 deletions

View File

@ -307,7 +307,7 @@ check_wlan_interfaces() {
# Check if they are recognized by ifconfig, if not unblock them with rfkill. # Check if they are recognized by ifconfig, if not unblock them with rfkill.
echo -e "\e[39m[+] Checking your wireless interfaces" echo -e "\e[39m[+] Checking your wireless interfaces"
for iface in $(ifconfig | grep -oE wlan[0-9]); do ifaces+=("$iface"); done for iface in $(ifconfig | grep -oE "(wlan[0-9]|wlx[a-f0-9]{12})"; do ifaces+=("$iface"); done
for iface in $(rfkill list | grep -oE phy[0-9]); do rfaces+=("$iface"); done for iface in $(rfkill list | grep -oE phy[0-9]); do rfaces+=("$iface"); done
if [[ "${#rfaces[@]}" > 1 ]]; then if [[ "${#rfaces[@]}" > 1 ]]; then

View File

@ -55,7 +55,7 @@ class Config(object):
# Changes for network interfaces. # Changes for network interfaces.
if cat == "network" and key in ["in", "out"]: if cat == "network" and key in ["in", "out"]:
if re.match("^wlan[0-9]{1}$", value): if re.match("^(wlan[0-9]|wlx[a-f0-9]{12})$", value):
if key == "in": if key == "in":
self.edit_configuration_files(value) self.edit_configuration_files(value)
config[cat][key] = value config[cat][key] = value
@ -120,7 +120,7 @@ class Config(object):
:return: list of the interfaces :return: list of the interfaces
""" """
try: try:
return [i for i in os.listdir("/sys/class/net/") if i.startswith("wlan")] return [i for i in os.listdir("/sys/class/net/") if i.startswith(("wlan", "wlx"))]
except: except:
return ["Interface not found", "Interface not found"] return ["Interface not found", "Interface not found"]
@ -130,7 +130,7 @@ class Config(object):
:return: nothing. :return: nothing.
""" """
try: try:
if re.match("^wlan[0-9]{1}$", iface): if re.match("^(wlan[0-9]|wlx[a-f0-9]{12})$", iface):
# Edit of DHCPD.conf # Edit of DHCPD.conf
with open("/etc/dhcpcd.conf", 'r') as file: with open("/etc/dhcpcd.conf", 'r') as file:
content = file.readlines() content = file.readlines()