--- write_net_rules.orig 2018-04-05 22:57:00.000000000 +0400 +++ write_net_rules 2019-08-18 14:08:46.057054843 +0400 @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/bash -e # This script is run to create persistent network device naming rules # based on properties of the device. @@ -42,6 +42,8 @@ . /lib/udev/rule_generator.functions +[ -f /etc/sysconfig/write_net_rules] && . /etc/sysconfig/write_net_rules + interface_name_taken() { local value="$(find_all_rules 'NAME=' $INTERFACE)" if [ "$value" ]; then @@ -117,6 +119,20 @@ basename=${INTERFACE%%[0-9]*} match="$match, KERNEL==\"$basename*\"" +ETHERDEFAULT=${ETHERDEFAULT:-ether} + +if [ "$ETHERDEFAULT" != "eth" ]; then + if [ "$basename" = "eth" ]; then + basename="$ETHERDEFAULT" + fi + if [[ $INTERFACE_NAME =~ (eth)([0-9]+) ]]; then + INTERFACE_NAME="$ETHERDEFAULT${BASH_REMATCH[2]}" + fi + if [[ $INTERFACE =~ (eth)([0-9]+) ]]; then + INTERFACE="$ETHERDEFAULT${BASH_REMATCH[2]}" + fi +fi + if [ "$INTERFACE_NAME" ]; then # external tools may request a custom name COMMENT="$COMMENT (custom name provided by external tool)"