fixed issue for makepkg paru and Root execution on worflow container
Some checks failed
Test setup and build APKs archlinux / Build-APK-Arch-Linux (push) Failing after 47s
Test setup and build APKs / Build-and-Create-Development-Environment (push) Successful in 11s

This commit is contained in:
2025-12-09 14:05:13 +01:00
parent 0f38b4cbaf
commit e163c82f15

13
dist/pacman.sh vendored
View File

@@ -28,7 +28,20 @@ if command -v paru &> /dev/null; then
else
git clone https://aur.archlinux.org/paru.git
cd paru
# Check if $USER is root and if so add a temporary non-root user for building paru
if [ "$EUID" -eq 0 ]; then
echo "Building paru as root is not allowed. Creating a temporary user for building..."
TEMP_USER="tempuser"
useradd -m "$TEMP_USER"
chown -R "$TEMP_USER":"$TEMP_USER" .
su -u "$TEMP_USER" -c "makepkg -si --noconfirm"
userdel -r "$TEMP_USER"
else
echo "Building paru as user $USER..."
makepkg -si --noconfirm
fi
cd ..
rm -rf paru
fi