Halt the VM automatically
This commit is contained in:
parent
7ddc804dc9
commit
7a103d054e
|
@ -1,5 +1,6 @@
|
||||||
(use-modules (gnu)
|
(use-modules (gnu)
|
||||||
(gnu services shepherd))
|
(gnu services shepherd)
|
||||||
|
(gnu packages admin))
|
||||||
|
|
||||||
(define my-service
|
(define my-service
|
||||||
(shepherd-service-type
|
(shepherd-service-type
|
||||||
|
@ -9,7 +10,9 @@
|
||||||
(documentation "This command is executed when the GUIX system boots.")
|
(documentation "This command is executed when the GUIX system boots.")
|
||||||
(provision '(my-stuff))
|
(provision '(my-stuff))
|
||||||
(start #~(lambda ()
|
(start #~(lambda ()
|
||||||
(system "(read len < /dev/sdb; dd if=/dev/sdc bs=1 count=$len | sh) > /dev/tty1")))))))
|
(system (string-append "(read len < /dev/sdb; head -c $len < /dev/sdc | sh -s "
|
||||||
|
#$shepherd
|
||||||
|
") > /dev/tty1"))))))))
|
||||||
|
|
||||||
(operating-system
|
(operating-system
|
||||||
(bootloader
|
(bootloader
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Usage: $0 shepherd"
|
||||||
|
echo "where shepherd is the path to shepherd in the GUIX store as"
|
||||||
|
echo "given by \`shepherd' from (use-modules (gnu packages admin))"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
{ read len_script; read len_tar; } < /dev/sdb
|
{ read len_script; read len_tar; } < /dev/sdb
|
||||||
pwd
|
pwd
|
||||||
|
@ -9,3 +16,11 @@ sha1sum signing-key.pub
|
||||||
|
|
||||||
guix archive --authorize < signing-key.pub
|
guix archive --authorize < signing-key.pub
|
||||||
guix archive --import < hello.nar
|
guix archive --import < hello.nar
|
||||||
|
|
||||||
|
# Wait for the control socket for shepherd to appear and halt the VM.
|
||||||
|
(
|
||||||
|
while [ ! -e /var/run/shepherd/socket ]; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
"$1/sbin/halt"
|
||||||
|
) &
|
||||||
|
|
Loading…
Reference in New Issue
Block a user