liminix-rebuild.sh (516B)
1 #!/usr/bin/env bash 2 3 ssh_command=${SSH_COMMAND-ssh} 4 target_host=$1 5 shift 6 7 if [ -z "$target_host" ] ; then 8 echo Usage: liminix-rebuild target-host params 9 exit 1 10 fi 11 12 if toplevel=$(nix-build "$@" -A outputs.systemConfiguration --no-out-link); then 13 echo systemConfiguration $toplevel 14 min-copy-closure $target_host $toplevel 15 $ssh_command $target_host cp -v -fP $toplevel/bin/* $toplevel/etc/* /persist 16 $ssh_command $target_host "sync; source /etc/profile; reboot" 17 else 18 echo Rebuild failed 19 fi