Commit 80eca94c authored by Johannes Löthberg's avatar Johannes Löthberg Committed by Allan McRae
Browse files

makepkg: Respect XDG_CONFIG_HOME



Add support for following the XDG Base Directory Specification when
reading the user-specific configuration file.

If no $XDG_CONFIG_HOME/pacman/makepkg.conf file exists we fall back to
sourcing $HOME/.makepkg.conf
Signed-off-by: Johannes Löthberg's avatarJohannes Löthberg <johannes@kyriasis.com>

[Allan] Note XDG_CONFIG_HOME takes priority.
Signed-off-by: Allan McRae's avatarAllan McRae <allan@archlinux.org>
parent 0e18cefe
......@@ -11,7 +11,7 @@ makepkg.conf - makepkg configuration file
Synopsis
--------
{sysconfdir}/makepkg.conf, ~/.makepkg.conf
{sysconfdir}/makepkg.conf, $XDG_CONFIG_HOME/pacman/makepkg.conf, ~/.makepkg.conf
Description
......@@ -27,7 +27,8 @@ variables. Some of them are non-standard.
The system-wide configuration file is found in {sysconfdir}/makepkg.conf.
Individual options can be overridden (or added to) on a per-user basis in
~/.makepkg.conf.
$XDG_CONFIG_HOME/pacman/makepkg.conf or ~/.makepkg.conf, with the former
taking priority.
The default file is fairly well commented, so it may be easiest to simply
follow directions given there for customization.
......
......@@ -2789,8 +2789,13 @@ fi
# Source user-specific makepkg.conf overrides, but only if no override config
# file was specified
if [[ $MAKEPKG_CONF = "$confdir/makepkg.conf" && -r ~/.makepkg.conf ]]; then
source_safe ~/.makepkg.conf
XDG_PACMAN_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/pacman"
if [[ "$MAKEPKG_CONF" = "$confdir/makepkg.conf" ]]; then
if [[ -r "$XDG_PACMAN_DIR/makepkg.conf" ]]; then
source_safe "$XDG_PACMAN_DIR/makepkg.conf"
elif [[ -r "$HOME/.makepkg.conf" ]]; then
source_safe "$HOME/.makepkg.conf"
fi
fi
# set pacman command if not already defined
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment