#---------------------------------------------------------------------------- # /var/install/include/nm-get-device-name - configuration of device-name # # Creation : 2025-11-05 hbfl # Last Update: $Id$ # # Copyright (c) 2001-@@YEAR@@ the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- # # included from nm-get-device, nm-get-device-name, nm-get-dhcpc # # --------------------------------------------------------------------------- # get network device name # --------------------------------------------------------------------------- get_name() { eth_name=${1} net_devices=$(/usr/bin/find /sys/class/net/ -maxdepth 1 -type l -printf '%f\n') # if name = eth? if echo "${net_devices}" | /usr/bin/grep -q -Ew "${eth_name}" then name=${eth_name} eth_found=true fi # if name != eth? if ! ${eth_found:-false} then name=$(echo "${net_devices}" | /usr/bin/grep -Ew '(enp[1-9]?[0-9]s[1-9]?[0-9][fu]?[1-9]?[0-9]?u?[1-9]?[0-9]?)|(en[os][1-9]?[0-9])|(enx[[:alnum:]]{12})') fi }