Files
apk/dist/pacman.sh
anorien90 b34ff3169e
All checks were successful
Test setup and build APKs archlinux / Build-APK-Arch-Linux (push) Successful in 38s
Test setup and build APKs / Build-and-Create-Development-Environment (push) Successful in 11s
fixed issue for makepkg paru and Root execution on worflow container
2025-12-09 14:09:29 +01:00

50 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Read the dist/packages.txt and install packages using pacman
PACKAGES_FILE="dist/packages.txt"
if [ ! -f "$PACKAGES_FILE" ]; then
echo "Packages file not found: $PACKAGES_FILE"
exit 1
else
mapfile -t packages < "$PACKAGES_FILE"
pacman -Syu --noconfirm "${packages[@]}"
fi
ARCH_PACKAGE_FILE="dist/arch/packages.txt"
if [ ! -f "$ARCH_PACKAGE_FILE" ]; then
echo "Arch-specific packages file not found: $ARCH_PACKAGE_FILE"
exit 1
else
mapfile -t arch_packages < "$ARCH_PACKAGE_FILE"
pacman -Syu --noconfirm "${arch_packages[@]}"
fi
if command -v paru &> /dev/null; then
echo "paru is already installed. Reinstalling..."
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 "$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