Makefile: use fakeroot for tar-ing rootfs

When tar-ing the rootfs, the permissions preserved are from the worker
process. This is not the intended behavior, as we want to preserve the
permissions of the root user to most of the files. Use fakeroot during
the tar process to automagically map the uid of the user to that of
root's.

Fixes #22

Signed-off-by: Santiago Torres <santiago@archlinux.org>
This commit is contained in:
Santiago Torres 2019-10-23 20:22:50 -04:00
parent a2b08c5fc1
commit 368a504fa3
No known key found for this signature in database
GPG Key ID: 468F122CE8162295

View File

@ -20,7 +20,9 @@ rootfs: hooks
# remove passwordless login for root (see CVE-2019-5021 for reference)
sed -i -e 's/^root::/root:!:/' "$(BUILDDIR)/etc/shadow"
tar --numeric-owner --xattrs --acls --exclude-from=exclude -C $(BUILDDIR) -c . -f archlinux.tar
# fakeroot to map the gid/uid of the builder process to root
# fixes #22
fakeroot -- tar --numeric-owner --xattrs --acls --exclude-from=exclude -C $(BUILDDIR) -c . -f archlinux.tar
rm -rf $(BUILDDIR) alpm-hooks
compress-rootfs: archlinux.tar