clustercfg: show diff before switching to new configuration
This is mildly hacky, but lets us be more informed before we switch to a
new configuration.
Change-Id: I008f3f698db702f1e0992bd41a8d1050449d59b5
diff --git a/cluster/nix/provision.nix b/cluster/nix/provision.nix
index 70240f6..20ed0a0 100644
--- a/cluster/nix/provision.nix
+++ b/cluster/nix/provision.nix
@@ -20,7 +20,16 @@
remote=root@${machine.fqdn}
echo "Configuration for ${machine.fqdn} is ${configuration.toplevel}"
nix copy --no-check-sigs -s --to ssh://$remote ${configuration.toplevel}
- ssh $remote ${configuration.toplevel}/bin/switch-to-configuration $1
+ echo "/etc/systemd/system diff:"
+ ssh $remote diff -ur /var/run/current-system/etc/systemd/system ${configuration.toplevel}/etc/systemd/system || true
+ echo ""
+ echo ""
+ ssh $remote ${configuration.toplevel}/bin/switch-to-configuration dry-activate
+ read -p "Do you want to switch to this configuration? " -n 1 -r
+ echo
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
+ ssh $remote ${configuration.toplevel}/bin/switch-to-configuration switch
+ fi
'';
machineProvisioners = builtins.listToAttrs (map (machine: {