blob: ea037db01a9ea4413c0883d02e33de5585e43d86 [file] [log] [blame]
#!/bin/bash
OUT=${KEEPME-tmp}
size=${SIZE-16G}
mkdir -p $OUT || exit 1
export DISK=$(mktemp --tmpdir=$OUT XXXXXXXXXXXXXXXX.img)
export EFIVAR=$OUT/$(basename $DISK .img).fd
truncate -s $size $DISK
truncate -s 64M $EFIVAR
if [ ! -z "$KEEPME" ]; then
(cat <<EOF
#!/bin/bash
EOF
export -p
cat <<EOF
$PWD/runefivm.sh $*
EOF
) >"$KEEPME"/runvm.sh
chmod a+x "$KEEPME"/runvm.sh
fi
./runefivm.sh $*
if [ -z "$KEEPME" ]; then
rm -f $DISK $EFIVAR
fi