Not-so-predictable network names
Ian Kelling
ian at iankelling.org
Wed Aug 10 11:56:46 CEST 2016
On Tue, Aug 9, 2016, at 07:38 PM, andrew bezella wrote:
> On Tue, 2016-08-09 at 14:12 -0700, Ian Kelling wrote:
> >
> > Yes, I'm following this path. At the top of 30-interface, I have a
> > condition
> > for if the os is in a class that uses a persistent name, and inside
> > I have this code:
>
> [...]
>
> oh! i like that solution, thanks for sharing...
>
> --
> andrew bezella <abezella at archive.org>
> Internet Archive
Thanks. Some of the long lines got wrapped in the mail.
Not sure if it was my client or the list, but here it is again
with shorter lines that hopefully do not get wrapped:
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
More information about the linux-fai
mailing list