osi-tools/osi-run

19 lines
616 B
Plaintext
Raw Normal View History

2018-08-06 01:49:45 +00:00
#!/usr/bin/env bash
# 2018 Luke Shumaker
{
set -euE
image="$1"
qemu=(
qemu-system-x86_64
-machine accel=kvm
-m 512
)
mountpoint=$(mktemp -dt -- "${0##*/}.XXXXXXXXXX")
trap "rmdir -- ${mountpoint@Q}" EXIT
2018-08-06 04:02:37 +00:00
sudo unshare --mount sh -c "mount --make-rslave / && mount ${image@Q} ${mountpoint@Q} && install -Dm755 /dev/stdin ${mountpoint@Q}/etc/osi-run"
2018-08-09 22:45:08 +00:00
"${qemu[@]}" -drive media=disk,format=raw,if=virtio,file="$image"
2018-08-06 04:02:37 +00:00
sudo unshare --mount sh -c "mount --make-rslave / && mount ${image@Q} ${mountpoint@Q} && cat ${mountpoint@Q}/var/log/osi-run.out; exit \$(cat ${mountpoint@Q}/var/log/osi-run.status)"
2018-08-06 01:49:45 +00:00
}