fixed issue for makepkg paru and Root execution on worflow container
This commit is contained in:
15
dist/pacman.sh
vendored
15
dist/pacman.sh
vendored
@@ -28,7 +28,20 @@ if command -v paru &> /dev/null; then
|
||||
else
|
||||
git clone https://aur.archlinux.org/paru.git
|
||||
cd paru
|
||||
makepkg -si --noconfirm
|
||||
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user