diff options
author | Michele Guerini Rocco <rnhmjoj@users.noreply.github.com> | 2024-06-03 15:30:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-03 15:30:13 +0200 |
commit | 9e97770a19765124649a47c8d056c2f4dd278e57 (patch) | |
tree | 3235e11478332b00eb0637a2c77fd4e57138fe7a /nixos/modules/tasks | |
parent | 55d72a7bfc730c54e046b4413930b3e9e486c978 (diff) | |
parent | 71ce6b582b473982c66eadc91081b5601dda7819 (diff) | |
download | nixlib-9e97770a19765124649a47c8d056c2f4dd278e57.tar nixlib-9e97770a19765124649a47c8d056c2f4dd278e57.tar.gz nixlib-9e97770a19765124649a47c8d056c2f4dd278e57.tar.bz2 nixlib-9e97770a19765124649a47c8d056c2f4dd278e57.tar.lz nixlib-9e97770a19765124649a47c8d056c2f4dd278e57.tar.xz nixlib-9e97770a19765124649a47c8d056c2f4dd278e57.tar.zst nixlib-9e97770a19765124649a47c8d056c2f4dd278e57.zip |
Merge pull request #312317 from tom-kuca/replace-existing-network-addresses
nixos/network-interfaces: prevent failure when a network address already exists
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r-- | nixos/modules/tasks/network-interfaces-scripted.nix | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/nixos/modules/tasks/network-interfaces-scripted.nix b/nixos/modules/tasks/network-interfaces-scripted.nix index 2f2d282fbefb..bbf2d337aac6 100644 --- a/nixos/modules/tasks/network-interfaces-scripted.nix +++ b/nixos/modules/tasks/network-interfaces-scripted.nix @@ -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 '' |