to-be-run-in-vm.sh (795B)
1 #!/bin/sh 2 set -e 3 4 if [ "$#" -ne 1 ]; then 5 echo "Usage: $0 shepherd" 6 echo "where shepherd is the path to shepherd in the GUIX store as" 7 echo "given by \`shepherd' from (use-modules (gnu packages admin))" 8 exit 1 9 fi 10 11 echo 12 { read len_script; read len_tar; } < /dev/sdb 13 pwd 14 head -c "$len_tar" /dev/sdd | tar -xf - 15 16 # Checking that hello is not available yet: 17 $(guix build hello)/bin/hello && echo "Expected hello to be missing at this point" && exit 1 18 19 # Import hello.nar 20 guix archive --authorize < signing-key.pub 21 guix archive --import < hello.nar 22 23 # This works: 24 $(guix build hello)/bin/hello 25 26 # This fails 27 guix build --check hello 28 29 # Wait for the control socket for shepherd to appear and halt the VM. 30 ( 31 while [ ! -e /var/run/shepherd/socket ]; do 32 sleep 1 33 done 34 "$1/sbin/halt" 35 ) &