move check-reboot script to deploy lib

This commit is contained in:
Sean Buckley 2022-01-02 17:40:07 -05:00
parent 0771a609fa
commit 2a9e86edd8
2 changed files with 9 additions and 15 deletions

View file

@ -67,8 +67,15 @@ let
$c exec -- '[ "$(echo '"'$j'"' | jq -r .$(hostname))" = "$(readlink /run/current-system)" ]' $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 in
{ inherit check-updates jump livecd-deploy pkgs sshConfig; }; { inherit check-updates check-reboots jump livecd-deploy pkgs sshConfig; };
in in
{ {
@ -80,6 +87,7 @@ in
alias ssh='ssh -F${sshConfig}' alias ssh='ssh -F${sshConfig}'
alias jump=${jump} alias jump=${jump}
alias check-updates=${check-updates} alias check-updates=${check-updates}
alias check-reboots=${check-reboots}
alias livecd-deploy=${livecd-deploy} alias livecd-deploy=${livecd-deploy}
alias c=colmena alias c=colmena
''; '';

View file

@ -53,20 +53,6 @@
print("compression ratio:", orig_data_size/mem_used_total) 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" '' (writeScriptBin "zfsram" ''
#!${pkgs.python3}/bin/python #!${pkgs.python3}/bin/python
for ln in open('/proc/spl/kstat/zfs/arcstats').readlines(): for ln in open('/proc/spl/kstat/zfs/arcstats').readlines():