git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Create a sysconfdir variable, and use it for ETC_GITCONFIG

From
Josh Triplett <josh@freedesktop.org>
Date
Apr 24, 2007, 07:51 UTC
Message-ID
<462DB707.4000008@freedesktop.org>
In-Reply-To
<462DB07C.5060500@freedesktop.org>

ETC_GITCONFIG defaults to $(prefix)/etc/gitconfig, so if you just set prefix=/usr, you end up with a git that looks in /usr/etc/gitconfig, rather than /etc/gitconfig as specified by the FHS. Furthermore, setting ETC_GITCONFIG does not fix the paths to any future system-wide configuration files.

Factor out the path to the system-wide configuration directory into a variable sysconfdir, normally set to $(prefix)/etc, but set to /etc when prefix=/usr . This fixes the prefix=/usr problem for ETC_GITCONFIG, and allows centralized configuration of any future system-wide configuration files without requiring further action from package maintainers or other people building and installing git.

Signed-off-by: Josh Triplett <josh@freedesktop.org>
---
 Makefile |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 65bd2db..60c41fd 100644
--- a/Makefile
+++ b/Makefile
@@ -141,7 +141,12 @@ prefix = $(HOME)
 bindir = $(prefix)/bin
 gitexecdir = $(bindir)
 template_dir = $(prefix)/share/git-core/templates/
-ETC_GITCONFIG = $(prefix)/etc/gitconfig
+ifeq ($(prefix),/usr)
+sysconfdir = /etc
+else
+sysconfdir = $(prefix)/etc
+endif
+ETC_GITCONFIG = $(sysconfdir)/gitconfig
 # DESTDIR=
 
 # default configuration for gitweb
@@ -160,7 +165,7 @@ GITWEB_FAVICON = git-favicon.png
 GITWEB_SITE_HEADER =
 GITWEB_SITE_FOOTER =
 
-export prefix bindir gitexecdir template_dir
+export prefix bindir gitexecdir template_dir sysconfdir
 
 CC = gcc
 AR = ar
-- 
1.5.1.1
Previous: Josh TriplettNext: Junio C Hamano
Message 6 of 11 in “Only use ETC_GITCONFIG=$(prefix)/etc/gitconfig ifeq ($(prefix),$(HOME))”
  1. Only use ETC_GITCONFIG=$(prefix)/etc/gitconfig ifeq ($(prefix),$(HOME))Josh Triplett, Apr 24, 2007
  2. Junio C HamanoApr 24, 2007
  3. Josh TriplettApr 24, 2007
  4. Junio C HamanoApr 24, 2007
  5. Josh TriplettApr 24, 2007
  6. Create a sysconfdir variable, and use it for ETC_GITCONFIGJosh Triplett, Apr 24, 2007
  7. Junio C HamanoApr 24, 2007
  8. Junio C HamanoApr 24, 2007
  9. Junio C HamanoApr 24, 2007
  10. Sergio CallegariApr 24, 2007
  11. Shawn O. PearceApr 24, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.