2024-04-04 00:17:36 +02:00
|
|
|
{
|
|
|
|
liminix
|
|
|
|
, nixpkgs
|
|
|
|
}:
|
|
|
|
let img = (import liminix {
|
|
|
|
device = import "${liminix}/devices/qemu/";
|
|
|
|
liminix-config = ./configuration.nix;
|
|
|
|
}).outputs.vmroot;
|
|
|
|
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
|
|
|
in pkgs.runCommand "check" {
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
|
|
expect
|
|
|
|
socat
|
|
|
|
e2fsprogs
|
|
|
|
util-linux # for sfdisk, fallocate
|
2024-04-15 23:15:27 +02:00
|
|
|
parted
|
2024-04-04 00:17:36 +02:00
|
|
|
] ;
|
|
|
|
} ''
|
|
|
|
mkdir vm
|
|
|
|
dd if=/dev/zero of=./vm/stick.e2fs bs=1M count=32
|
|
|
|
mkfs.ext2 -L backup-disk ./vm/stick.e2fs
|
2024-04-15 23:15:27 +02:00
|
|
|
dd if=/dev/zero of=./vm/stick.img bs=1M count=38
|
|
|
|
dd if=./vm/stick.e2fs of=./vm/stick.img bs=512 seek=34 conv=notrunc
|
|
|
|
parted -s ./vm/stick.img -- mklabel gpt mkpart backup-disk ext2 34s -0M
|
2024-04-04 00:17:36 +02:00
|
|
|
|
2024-04-27 23:41:30 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
${img}/run.sh --background ./vm --flag -device --flag usb-ehci,id=xhci --flag -drive --flag if=none,id=usbstick,format=raw,file=$(pwd)/vm/stick.img
|
|
|
|
expect ${./script.expect} late
|
|
|
|
kill $(cat ./vm/pid)
|
|
|
|
|
2024-04-04 00:17:36 +02:00
|
|
|
${img}/run.sh --background ./vm --flag -device --flag usb-ehci,id=xhci --flag -drive --flag if=none,id=usbstick,format=raw,file=$(pwd)/vm/stick.img
|
2024-04-27 23:41:30 +02:00
|
|
|
expect ${./script.expect} early
|
|
|
|
|
|
|
|
} | tee $out
|
|
|
|
|
2024-04-04 00:17:36 +02:00
|
|
|
''
|