nixos-install-scripts icon indicating copy to clipboard operation
nixos-install-scripts copied to clipboard

hetzner: Tighter regex match for INTERFACE_DEVICE_PATH

Open nh2 opened this issue 2 years ago • 0 comments

I found a case on a Hetzner SX134 server with an addiitonal 10 G network interface that in

https://github.com/nix-community/nixos-install-scripts/blob/552eb22477c84db9e17314e898050cd18981e1bd/hosters/hetzner-dedicated/hetzner-dedicated-wipe-and-install-nixos.sh#L184

we need

-INTERFACE_DEVICE_PATH=$(udevadm info -e | grep -Po "(?<=^P: )(.*${RESCUE_INTERFACE})")
+INTERFACE_DEVICE_PATH=$(udevadm info -e | grep -Po "(?<=^P: )(.*${RESCUE_INTERFACE})$")

Otherwise we can get two maches:

# udevadm info -e | grep -P "(?<=^P: )(.*eth1)"
P: /devices/pci0000:00/0000:00:01.1/0000:01:00.0/net/eth1
P: /devices/pci0000:00/0000:00:01.1/0000:01:00.0/net/eth1/ixgbe-mdio-0000:01:00.0

when in fact we want to match only the first line.

nh2 avatar Aug 06 '22 16:08 nh2