I use a program (yay, in archlinux) which uses sudo to elevate privileges. However, if it doesn't find sudo, it will switch to su, which is what I want it to do, since my user is not a sudoer, but I do have sudo installed (because there's another program which needs sudo to be installed even when run as root, I know it's silly).
Now the question is, how can I run this program (yay), while making it think sudo doesn't exist?
Note that yay is a package manager (AUR helper) which also builds and installs packages from source, and you can't do those builds as root, for security reasons, which is fair enough.
Also note that I've already opened an issue here on yay's repo, but while that's being fixed, I'd appreciate an alternative solution.
su -c yay?sudo's directory from your PATH when launchingyay, but that won't work since on Arch,sudois in/sbinwhich is just a symlink to/usr/binand removing that would mean none of the scripts called byyaywill work. If adding your user tosudoersisn't an option, I fear you're stuck and will have to modify yay to remove thesudocheck.yay. In there there is the mentioning of a--sudooption that takes the command to call instead ofsudo. When you tryyay --sudo su, how does it fail? Did you alse try modifying thesucommand in this way by means of the--sudoflagsoption?yay --sudo=sujust doesn't do anything, no fail, no message, just exits.