liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

liminix-rebuild.sh (593B)


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