-if ! ifclass STABLE; then
- if ifclass VM; then
- # For a vm, we only get ID_NET_NAME_MAC from below,
- # but when it reboots, it uses ID_NET_NAME_SLOT.
- NIC1=ens3
- else
- # get persistent interface name. Note, these class conditions
- # will need to get modified for new oses. testing vm doesn't use
- # it right now, but other vms do I'm sure.
- for field in ID_NET_NAME_FROM_DATABASE \
- ID_NET_NAME_ONBOARD \
- ID_NET_NAME_SLOT \
- ID_NET_NAME_PATH \
- ID_NET_NAME_MAC; 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"
- exit 1
- fi
+newnicnames() {
+
+ # determine predictable network names only for stretch and above
+
+ [ $do_init_tasks -eq 0 ] && return
+
+ ver=$($ROOTCMD dpkg-query --showformat='${Version}' --show udev)
+ if dpkg --compare-versions $ver lt 220-7; then
+ return