mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
Merge pull request #316911 from NixOS/backport-312317-to-release-24.05
[Backport release-24.05] nixos/network-interfaces: prevent failure when a network address already exists
This commit is contained in:
commit
92706b2141
@ -203,10 +203,10 @@ let
|
||||
''
|
||||
echo "${cidr}" >> $state
|
||||
echo -n "adding address ${cidr}... "
|
||||
if out=$(ip addr add "${cidr}" dev "${i.name}" 2>&1); then
|
||||
if out=$(ip addr replace "${cidr}" dev "${i.name}" 2>&1); then
|
||||
echo "done"
|
||||
elif ! echo "$out" | grep "File exists" >/dev/null 2>&1; then
|
||||
echo "'ip addr add "${cidr}" dev "${i.name}"' failed: $out"
|
||||
else
|
||||
echo "'ip addr replace "${cidr}" dev "${i.name}"' failed: $out"
|
||||
exit 1
|
||||
fi
|
||||
''
|
||||
|
Loading…
Reference in New Issue
Block a user