mcarans wrote: ↑Fri Dec 19, 2025 5:12 am
Lone_Wolf wrote: ↑Sat Dec 13, 2025 11:06 pm
Pacman is essentially a cli-frontend for libalpm.so and all systemwide installations on archlinux are maintained through libalpm .
Other package managers like flatpak, pip, conda, kde discover , gnome sw centre, steam etc either communicate with libalpm or stick to user installs (probably 99% do the latter on archlinux)
Pacman/libalpm are forbidden to touch user folders. This means anything under $HOME and /usr/local .
So as long as configure/make/make install or modern equivalent only touches /usr/local its fine.
If installing deps is needed, it should be done manually through a pacman command listed in documentation.
Just wanted to check something as I think I may have misunderstood what you said. I have removed sudo for installing packages on Arch, but AI says "On Arch Linux, yes—you typically need sudo to install packages system-wide using pacman, because it modifies system directories like /usr and /etc." You definitely need it to build from source on Ubuntu and Fedora as various system packages must be installed (like clang, SDL etc.). The reason it works in GitHub Actions without it is because containers by default run as root.
I was thinking of adding a root check like this:
Code: Select all
if [ -z "${SUDO_CMD+set}" ]; then
if [ "$(id -u)" -eq 0 ]; then
echo "Running as root - no need for sudo"
SUDO_CMD = ""
else
echo "Not running as root - will sudo when needed"
SUDO_CMD = "sudo"
fi
fi
The script would then use sudo if not root and not use sudo if root. If really needed, a user could override by explicitly setting SUDO_CMD to either "" or "sudo" before running the script. Would that work on Arch?
AI slop wrote:
AI says "On Arch Linux, yes—you typically need sudo to install packages system-wide using pacman, because it modifies system directories like /usr and /etc.
That should be 'needs root rights' for the following reasons :
Sudo is not part of the arch base meta-package that should be present on all arch systems.
It
is in the base-devel package, but the default sudoers file only contains comments/examples. Without user configuration sudo will do nothing on arch.
su on the other hand comes with utils-linux which is in base.
The only 100% guaranteed methods to get root access on Arch Linux are:
login as root or
use su
Scripts run as the user that starts it. If the script uses
sudo foo internally foo will be run as that other user in their environment ! This can cause all kinds of undesired effects and makes troubleshooting much harder.
(su has the same issues btw)
Packaging tools have special code to prevent such issues or don't use sudo/su/doas etc at all.
The simplest method to avoid those issues is separate anything that requires root rights from stuff that needs to run as user.
For your sourcebuild in /usr/local that would result in 2 scripts :
one to install deps that needs to be run with root rights.
A second one that runs as normal user and compiles oolite .