aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Zyngier <maz@kernel.org>2021-02-06 10:38:26 +0000
committerMarc Zyngier <maz@kernel.org>2021-02-06 10:40:59 +0000
commit850ce992e2f0b56252b9f368bd5caef206d8640c (patch)
treeaad89dabb1ce0e277ecad94fc96227c4eadbcde5
parent02791c4e73dfcf54ecaa3ed302da50b70d51b4e9 (diff)
downloadvminstall-850ce992e2f0b56252b9f368bd5caef206d8640c.tar.gz
runinstallvm: Add TEMPLATE option for self-contained install
Signed-off-by: Marc Zyngier <maz@kernel.org>
-rw-r--r--README5
-rwxr-xr-xruninstallvm.sh3
2 files changed, 7 insertions, 1 deletions
diff --git a/README b/README
index 3658dbb..3e55846 100644
--- a/README
+++ b/README
@@ -80,8 +80,11 @@ at some point. Maybe.
generate a "runvm.sh" script in the same directory, which calls
runefivm.sh with the right environment variables.
-* build-cd-image source.iso target.iso
+ - TEMPLATE: A disk image that is used to pre-populates the virtio
+ disk (useful for things like mini.iso that will pull everything
+ from the network).
+* build-cd-image source.iso target.iso
- Debian/Ubuntu: Takes source.iso, adds preseed.cfg to it, add a new
grub entry for unattended installation, repack the whole thing as
diff --git a/runinstallvm.sh b/runinstallvm.sh
index ea037db..5d6ea70 100755
--- a/runinstallvm.sh
+++ b/runinstallvm.sh
@@ -2,6 +2,7 @@
OUT=${KEEPME-tmp}
size=${SIZE-16G}
+template=${TEMPLATE-/dev/null}
mkdir -p $OUT || exit 1
@@ -9,6 +10,8 @@ export DISK=$(mktemp --tmpdir=$OUT XXXXXXXXXXXXXXXX.img)
export EFIVAR=$OUT/$(basename $DISK .img).fd
truncate -s $size $DISK
+dd if=$template of=$DISK bs=1M conv=notrunc status=none
+
truncate -s 64M $EFIVAR
if [ ! -z "$KEEPME" ]; then