]> git.ipfire.org Git - thirdparty/git.git/commit
t/lib-httpd: dynamically detect httpd and modules path
authorPatrick Steinhardt <ps@pks.im>
Fri, 10 Nov 2023 08:17:00 +0000 (09:17 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sat, 11 Nov 2023 00:00:42 +0000 (09:00 +0900)
commit7d05974d725a68b2498b2b0041e5e1e01c0187ac
tree967c2b5da0c3a6d85aa6fa364be087f3ca658c68
parentdadef801b365989099a9929e995589e455c51fed
t/lib-httpd: dynamically detect httpd and modules path

In order to set up the Apache httpd server, we need to locate both the
httpd binary and its default module path. This is done with a hardcoded
list of locations that we scan. While this works okayish with distros
that more-or-less follow the Filesystem Hierarchy Standard, it falls
apart on others like NixOS that don't.

While it is possible to specify these paths via `LIB_HTTPD_PATH` and
`LIB_HTTPD_MODULE_PATH`, it is not a nice experience for the developer
to figure out how to set those up. And in fact we can do better by
dynamically detecting both httpd and its module path at runtime:

    - The httpd binary can be located via PATH.

    - The module directory can (in many cases) be derived via the
      `HTTPD_ROOT` compile-time variable.

Amend the code to do so.

Note that the new runtime-detected paths will only be used as a fallback
in case none of the hardcoded paths are usable. For the PATH lookup this
is because httpd is typically installed into "/usr/sbin", which is often
not included in the user's PATH variable. And the module path detection
relies on a configured httpd installation and may thus not work in all
cases, either.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/lib-httpd.sh