Skip to content

Commit

Permalink
[Arista] Fix arista-net initramfs hook (#10624)
Browse files Browse the repository at this point in the history
The interface renaming logic fails if one interface is missing.
Because of the `set -e` the whole initramfs hook would abort early on
error.
This change fixes the current behavior to make sure missing interfaces
are properly skipped and ensure existing interface are renamed.
  • Loading branch information
Staphylo authored Apr 20, 2022
1 parent 128d762 commit fb14776
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion files/initramfs-tools/arista-net
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ arista_net_rename() {
local new_name="$2"
local from_name="$3"
devname=$(arista_net_devname "$device_path" "$from_name")
[ -n "$devname" ] && ip link set "$devname" name "$new_name"
if [ -n "$devname" ]; then
ip link set "$devname" name "$new_name"
fi
}

# Sets the MAC address to the value passed by Aboot through /proc/cmdline
Expand Down

0 comments on commit fb14776

Please sign in to comment.