From 2a9e86edd88cd6b2763fdc5901d79e0cc035195b Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Sun, 2 Jan 2022 17:40:07 -0500 Subject: [PATCH] move check-reboot script to deploy lib --- lib/deploy.nix | 10 +++++++++- modules/cli/default.nix | 14 -------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/lib/deploy.nix b/lib/deploy.nix index 82c2fa6..e9f0b69 100644 --- a/lib/deploy.nix +++ b/lib/deploy.nix @@ -67,8 +67,15 @@ let $c exec -- '[ "$(echo '"'$j'"' | jq -r .$(hostname))" = "$(readlink /run/current-system)" ]' ''; + check-reboots = pkgs.writeShellScript "check-reboots" '' + set -eu + export SSH_CONFIG_FILE=${sshConfig} + c="${pkgs.colmena}/bin/colmena" + $c exec -- '[ "$(readlink /run/booted-system/kernel)" = "$(readlink /run/current-system/kernel)" ]' + ''; + in - { inherit check-updates jump livecd-deploy pkgs sshConfig; }; + { inherit check-updates check-reboots jump livecd-deploy pkgs sshConfig; }; in { @@ -80,6 +87,7 @@ in alias ssh='ssh -F${sshConfig}' alias jump=${jump} alias check-updates=${check-updates} + alias check-reboots=${check-reboots} alias livecd-deploy=${livecd-deploy} alias c=colmena ''; diff --git a/modules/cli/default.nix b/modules/cli/default.nix index 39c1272..1579358 100644 --- a/modules/cli/default.nix +++ b/modules/cli/default.nix @@ -53,20 +53,6 @@ print("compression ratio:", orig_data_size/mem_used_total) '') - (writeShellScriptBin "nixos-check-reboot" '' - set -e - booted="$(readlink /run/booted-system/kernel)" - current="$(readlink /run/current-system/kernel)" - if [ "$booted" = "$current" ] - then - echo OK - exit 0 - else - echo REBOOT NEEDED - exit 1 - fi - '') - (writeScriptBin "zfsram" '' #!${pkgs.python3}/bin/python for ln in open('/proc/spl/kstat/zfs/arcstats').readlines():