1
0
mirror of https://passt.top/passt synced 2024-11-10 06:30:13 +00:00
passt/test/prepare-distro-img.sh
David Gibson 460064d262 test: Avoid hitting guestfish command length limits
In test/prepare-distro-img.sh we use guestfish to tweak our distro guest
images to be suitable.  Part of this is using a 'copy-in' directive to copy
in the source files for passt itself.  Currently we copy in all the files
with a single 'copy-in', since it allows listing multiple files.  However
it turns out that the number of arguments it can accept is fairly limited
and our current list of files is already very close to that limit.

Instead, expand our list of files to one copy-in per file, avoiding that
limitation.  This isn't much slower, because all the commands still run in
a single invocation of guestfish itself.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
2023-12-04 09:51:26 +01:00

19 lines
683 B
Bash
Executable File

#! /bin/sh -e
IMG="$1"
PASST_FILES="$(echo ../*.c ../*.h ../*.sh ../*.1 ../Makefile ../README.md)"
virt-edit -a $IMG /lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --autologin root -8 --keep-baud 115200,38400,9600 %I $TERM/g'
guestfish --rw -a $IMG -i <<EOF
rm-f /usr/lib/systemd/system/cloud-config.service
rm-f /usr/lib/systemd/system/cloud-init.service
rm-f /usr/lib/systemd/system/cloud-init-local.service
rm-f /usr/lib/systemd/system/cloud-final.service
rm-f /etc/init.d/cloud-config
rm-f /etc/init.d/cloud-final
rm-f /etc/init.d/cloud-init
rm-f /etc/init.d/cloud-init-local
$(for f in $PASST_FILES; do echo copy-in $f /root; done)
EOF