26 lines
675 B
Bash
Executable file
26 lines
675 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# SPDX-FileCopyrightText: 2025 Lubin Bailly <lubin.bailly@dgnum.eu>
|
|
#
|
|
# SPDX-License-Identifier: EUPL-1.2
|
|
|
|
set -Eeuo pipefail
|
|
|
|
ssh_command=${SSH_COMMAND-ssh}
|
|
|
|
target_host=$1
|
|
shift
|
|
|
|
if [ -z "$target_host" ] ; then
|
|
echo Usage: netconf-apply target-host
|
|
exit 1
|
|
fi
|
|
|
|
if toplevel="$(nix-build $(colmena eval -E "{ nodes, ... }: nodes.${target_host}.config.netconf.rpc" --instantiate))"; then
|
|
$ssh_command $(colmena eval -E "{nodes, ...}:
|
|
with nodes.${target_host}.config.deployment;
|
|
\"\${targetUser}@\${targetHost} \${builtins.concatStringsSep \" \" sshOptions}\"" | sed 's/"//g') \
|
|
-s netconf < $toplevel
|
|
else
|
|
echo Build failed
|
|
fi
|