Merge pull request #312317 from tom-kuca/replace-existing-network-addresses
nixos/network-interfaces: prevent failure when a network address already exists
This commit is contained in:
commit
9e97770a19
@ -203,10 +203,10 @@ let
|
|||||||
''
|
''
|
||||||
echo "${cidr}" >> $state
|
echo "${cidr}" >> $state
|
||||||
echo -n "adding address ${cidr}... "
|
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"
|
echo "done"
|
||||||
elif ! echo "$out" | grep "File exists" >/dev/null 2>&1; then
|
else
|
||||||
echo "'ip addr add "${cidr}" dev "${i.name}"' failed: $out"
|
echo "'ip addr replace "${cidr}" dev "${i.name}"' failed: $out"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
''
|
''
|
||||||
|
Loading…
Reference in New Issue
Block a user