Changing UID to that of 'nobody' is arbitrary at best, and an
information leak at worst. Let's just drop back to the same UID of the
invoker.
---
makechrootpkg.in | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/makechrootpkg.in b/makechrootpkg.in
index 8bc18a4..9bb0bfa 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -234,7 +234,9 @@ prepare_chroot() {
echo 'SRCDEST="/srcdest"' >> "$copydir/etc/makepkg.conf"
fi
- chown -R nobody "$copydir"/{build,pkgdest,srcpkgdest,logdest,srcdest,startdir}
+ builduser_uid=${SUDO_UID:-$UID}
+ useradd -R "$copydir" -g users -u "$builduser_uid" -s /bin/nologin builduser
+ chown -R "$builduser_uid" "$copydir"/{build,pkgdest,srcpkgdest,logdest,srcdest,startdir}
if [[ -n $MAKEFLAGS ]]; then
sed -i '/^MAKEFLAGS=/d' "$copydir/etc/makepkg.conf"
@@ -246,12 +248,12 @@ prepare_chroot() {
echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf"
fi
- if [[ ! -f $copydir/etc/sudoers.d/nobody-pacman ]]; then
- cat > "$copydir/etc/sudoers.d/nobody-pacman" <