need /.host/qemu* in the chroot if qemu is used

The original commit broke system tar2fs use by accidentally
moving TOPDIR definition into a separate shell execution;
thanks iv@ for spotting and fixing it promptly.

Co-authored-by: Ivan A. Melnikov" <iv@altlinux.org>
This commit is contained in:
Dmitriy Terekhin 2019-01-09 15:12:47 +04:00 committed by Michael Shigorin
parent 803bdabbd2
commit be75d3c3d2
2 changed files with 18 additions and 1 deletions

View File

@ -218,6 +218,16 @@ if [ -n "$BOOTPART" ]; then
echo "$BOOTDEV /boot $BOOTFSTYPE defaults 1 2" >> "$ROOTFS/etc/fstab"
fi
# Query ARCH in chroot and redefine arch-dependent variable
ARCH="$(chroot "$ROOTFS" rpm --eval '%_host_cpu')"
if [[ $ARCH = *86* ]]
then # NB: different storage modules might be needed for non-kvm
INITRD_MODULES="sd_mod ata_piix ahci virtio-scsi virtio-blk"
else
INITRD_MODULES=
fi
echo "MODULES_PRELOAD += $INITRD_MODULES $ROOTFSTYPE" >> "$ROOTFS/etc/initrd.mk"
case "$ARCH" in
@ -315,3 +325,6 @@ fi
if [ -n "$SUDO_USER" ]; then
chown "$SUDO_USER:$(id -g "$SUDO_USER")" "$IMG" "$ROOTFS" "$WORKDIR" ||:
fi
# maybe qemu interpreter was copied to chroot;
# this is no longer necessary, remove
rm -rf "$ROOTFS"/.host ||:

View File

@ -23,7 +23,11 @@ check-sudo:
fi
prepare-image: check-sudo
@if [ -x /usr/share/mkimage-profiles/bin/tar2fs ]; then \
@# need to copy $(BUILDDIR)/.work/chroot/.host/qemu* into chroot
@#if qemu is used
@(cd "$(BUILDDIR)/.work/chroot/"; \
tar -rf "$(VM_TARBALL)" ./.host/qemu*) ||:; \
if [ -x /usr/share/mkimage-profiles/bin/tar2fs ]; then \
TOPDIR=/usr/share/mkimage-profiles; \
fi; \
if ! sudo $$TOPDIR/bin/tar2fs \