Use correct path for system tar2fs

tar2fs comes from m-p, not from mkimage. Also, we should
use $TOPDIR from shell, not $(TOPDIR) from make, when
calling it.

Note: this is a security fix for environments relying
on packaged mkimage-profiles with sudo enabled for the
builder user.

Fixes: f293239d5b
This commit is contained in:
Ivan A. Melnikov 2018-12-10 13:10:13 +04:00 committed by Michael Shigorin
parent 4cc5067d7d
commit 98a9c1f303

View File

@ -23,11 +23,11 @@ check-sudo:
fi
prepare-image: check-sudo
@if [ -x $(MKIMAGE_PREFIX)/bin/tar2fs ]; then \
TOPDIR=$(MKIMAGE_PREFIX); \
@if [ -x /usr/share/mkimage-profiles/bin/tar2fs ]; then \
TOPDIR=/usr/share/mkimage-profiles; \
fi; \
if ! sudo $(TOPDIR)/bin/tar2fs \
"$(VM_TARBALL)" "$(VM_RAWDISK)" $(VM_SIZE) $(VM_FSTYPE); then \
if ! sudo $$TOPDIR/bin/tar2fs \
"$(VM_TARBALL)" "$(VM_RAWDISK)" $(VM_SIZE) $(VM_FSTYPE); then \
echo "** error: sudo tar2fs failed, see build log" >&2; \
exit 1; \
fi