grub-shell: support --files also for net boot

This allows running tests that require extra files using netboot as well.
This commit is contained in:
Andrei Borzenkov 2014-12-05 19:55:59 +03:00
parent 3173c7501c
commit 4b94e3227b
2 changed files with 21 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2014-12-05 Andrei Borzenkov <arvidjaar@gmail.com>
* tests/util/grub-shell.in: Support --files also for netboot.
2014-12-01 Andrei Borzenkov <arvidjaar@gmail.com>
* grub-core/loader/i386/xen_fileXX.c (grub_xen_get_infoXX): Fix

View file

@ -422,11 +422,28 @@ do_trim ()
fi
}
copy_extra_files() {
_destdir="$1"
shift
# FIXME support '=' in file names
for _file in "$@"; do
_target="${_file%=*}"
_source="${_file#*=}"
[ -n "$_source" ] || _source="$_target"
_target="$_destdir/$_target"
_targetdir="$(dirname "$_target")"
[ -d "$_targetdir" ] || mkdir -p "$_targetdir"
cp "$_source" "$_target"
done
}
if [ x$boot = xnet ]; then
netdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
pkgdatadir="@builddir@" "@builddir@/grub-mknetdir" "--grub-mkimage=${builddir}/grub-mkimage" "--directory=${builddir}/grub-core" "--net-directory=$netdir" ${mkrescue_args} > /dev/null
cp "${cfgfile}" "$netdir/boot/grub/grub.cfg"
cp "${source}" "$netdir/boot/grub/testcase.cfg"
[ -z "$files" ] || copy_extra_files "$netdir" $files
timeout -s KILL $timeout "${qemu}" ${qemuopts} ${serial_null} -serial file:/dev/stdout -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/${grub_modinfo_target_cpu}-${grub_modinfo_platform}/core.$netbootext" -net nic | cat | tr -d "\r" | do_trim
elif [ x$boot = xemu ]; then
grubdir="$(mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX")"