Use portable pathnames
These changes switch the code to use PATH to find programs, or try /usr and / for files that might be canonically located in either location depending on whether the system is merged-/usr or unmerged-/usr, or depending on the local system policies.
I've tested this on my systems for a while with moved-/usr (but no merged-/usr via aliased symlinks), and at least the parts that my system exercises seem to work fine.