Skip to content

Commit

Permalink
determine predictable network names, Closes: #834817
Browse files Browse the repository at this point in the history
currently booting dracut's initrd with FAI still gives eth0 when using
stretch, maybe udevadm must be called to rename the network devices
  • Loading branch information
ian-kelling authored and Thomas Lange committed Oct 12, 2016
1 parent 4cd6897 commit 9f05474
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions examples/simple/scripts/DEBIAN/30-interface
Expand Up @@ -4,6 +4,20 @@ error=0; trap 'error=$(($?>$error?$?:$error))' ERR # save maximum error code

if ifclass DHCPC && [ $FAI_ACTION = "install" -o $FAI_ACTION = "dirinstall" ]
then

# determine predictable network names
fields="ID_NET_NAME_FROM_DATABASE ID_NET_NAME_ONBOARD ID_NET_NAME_SLOT ID_NET_NAME_PATH ID_NET_NAME_MAC"
for field in $fields; do
name=$(udevadm info /sys/class/net/$NIC1 | sed -rn "s/^E: $field=(.+)/\1/p")
if [[ $name ]]; then
NIC1=$name
break
fi
done
if [[ ! $name ]]; then
echo "$0: error: could not find systemd predictable network name. Using $NIC1."
fi

cat > $target/etc/network/interfaces <<-EOF
# generated by FAI
auto lo $NIC1
Expand Down

0 comments on commit 9f05474

Please sign in to comment.