kexec-installer: only one file for addresses is needed
This commit is contained in:
parent
be9c564503
commit
b70c9d2fe9
2 changed files with 10 additions and 15 deletions
|
@ -36,10 +36,9 @@ in {
|
|||
|
||||
# save the networking config for later use
|
||||
if type -p ip &>/dev/null; then
|
||||
ip -4 --json addr > addrs-v4.json
|
||||
ip -4 --json addr > addrs-v6.json
|
||||
ip --json addr > addrs.json
|
||||
|
||||
ip -6 --json route > routes-v4.json
|
||||
ip -4 --json route > routes-v4.json
|
||||
ip -6 --json route > routes-v6.json
|
||||
else
|
||||
echo "Skip saving static network addresses because no iproute2 binary is available." 2>&1
|
||||
|
@ -100,12 +99,11 @@ in {
|
|||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig.ExecStart = [
|
||||
"${restoreNetwork} /root/network/addrs-v4.json /root/network/addrs-v6.json /root/network/routes-v4.json /root/network/routes-v6.json"
|
||||
"${restoreNetwork} /root/network/addrs.json /root/network/routes-v4.json /root/network/routes-v6.json"
|
||||
];
|
||||
|
||||
unitConfig.ConditionPathExists = [
|
||||
"/root/network/addrs-v4.json"
|
||||
"/root/network/addrs-v6.json"
|
||||
"/root/network/addrs.json"
|
||||
"/root/network/routes-v4.json"
|
||||
"/root/network/routes-v6.json"
|
||||
];
|
||||
|
|
|
@ -85,28 +85,25 @@ IPv6AcceptRA = yes
|
|||
|
||||
|
||||
def main() -> None:
|
||||
if len(sys.argv) < 5:
|
||||
if len(sys.argv) < 4:
|
||||
print(
|
||||
f"USAGE: {sys.argv[0]} addresses-v4 addresses-v6 routes-v4 routes-v6 [networkd-directory]",
|
||||
f"USAGE: {sys.argv[0]} addresses routes-v4 routes-v6 [networkd-directory]",
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
with open(sys.argv[1]) as f:
|
||||
v4_addresses = json.load(f)
|
||||
addresses = json.load(f)
|
||||
with open(sys.argv[2]) as f:
|
||||
v6_addresses = json.load(f)
|
||||
with open(sys.argv[3]) as f:
|
||||
v4_routes = json.load(f)
|
||||
with open(sys.argv[4]) as f:
|
||||
with open(sys.argv[3]) as f:
|
||||
v6_routes = json.load(f)
|
||||
|
||||
if len(sys.argv) >= 5:
|
||||
networkd_directory = Path(sys.argv[5])
|
||||
if len(sys.argv) >= 4:
|
||||
networkd_directory = Path(sys.argv[4])
|
||||
else:
|
||||
networkd_directory = Path("/etc/systemd/network")
|
||||
|
||||
addresses = v4_addresses + v6_addresses
|
||||
relevant_interfaces = filter_interfaces(addresses)
|
||||
relevant_routes = filter_routes(v4_routes) + filter_routes(v6_routes)
|
||||
|
||||
|
|
Loading…
Reference in a new issue