From 94384afdb61062454edf37869f0df1deb3722673 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 25 Nov 2022 11:37:50 +0000 Subject: [PATCH] kexec-installer: fixes for restoreNetwork --- nix/kexec-installer.nix | 6 +++--- nix/restore_routes.py | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/nix/kexec-installer.nix b/nix/kexec-installer.nix index e7d30ca..f0df0e7 100644 --- a/nix/kexec-installer.nix +++ b/nix/kexec-installer.nix @@ -1,6 +1,6 @@ { config, lib, modulesPath, pkgs, ... }: let - restoreNetwork = pkgs.writers.writePython3Bin "restore-network" { + restoreNetwork = pkgs.writers.writePython3 "restore-network" { flakeIgnore = ["E501"]; } ./restore_routes.py; in { @@ -35,7 +35,7 @@ in { done # save the networking config for later use - if ! type -p ip &>/dev/null; then + if type -p ip &>/dev/null; then ip --json addr > addrs.json ip --json route > routes.json else @@ -95,7 +95,7 @@ in { pkgs.iproute2 ]; wantedBy = [ "multi-user.target" ]; - after = [ "network.target" ]; + after = [ "network-online.target" ]; serviceConfig.ExecStart = "${restoreNetwork} /root/network/addrs.json /root/network/routes.json"; unitConfig.ConditionPathExists = [ diff --git a/nix/restore_routes.py b/nix/restore_routes.py index 9892b20..e35e012 100644 --- a/nix/restore_routes.py +++ b/nix/restore_routes.py @@ -70,6 +70,8 @@ def main() -> None: route["gateway"], "dev", current_interface["ifname"], + "preference", + "1", ], check=True ) @@ -82,6 +84,8 @@ def main() -> None: route["dst"], "dev", current_interface["ifname"], + "preference", + "1", ], check=True )