PKGDEST and other variables can be set in /etc/makepkg.conf and local
correspondents in $HOME, with the file in /etc taking precedence.
Specifying a default makepkg.conf on the command line (similar to
makepkg) allows to change the directory where build products are moved
(move_products), without the need to modify the system configuration
in /etc/makepkg.conf or rely on sudoers policy.
Fixes FS#44827
---
makechrootpkg.in | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/makechrootpkg.in b/makechrootpkg.in
index cd9efce..efb3cdd 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -21,6 +21,7 @@ run_namcap=false
temp_chroot=false
chrootdir=
passeddir=
+makepkg_conf=/etc/makepkg.conf
declare -a install_pkgs
declare -i ret=0
@@ -63,6 +64,7 @@ usage() {
echo " Default: $copy"
echo '-n Run namcap on the package'
echo '-T Build in a temporary directory'
+ echo '-M Load variables from an alternate config file'
exit 1
}
@@ -252,7 +254,7 @@ move_products() {
orig_argv=("$@")
-while getopts 'hcur:I:l:nTD:d:' arg; do
+while getopts 'hcur:I:l:nTD:d:M:' arg; do
case "$arg" in
c) clean_first=true ;;
D) bindmounts_ro+=(--bind-ro="$OPTARG") ;;
@@ -263,11 +265,13 @@ while getopts 'hcur:I:l:nTD:d:' arg; do
l) copy="$OPTARG" ;;
n) run_namcap=true; makepkg_args+=(-i) ;;
T) temp_chroot=true; copy+="-$$" ;;
+ M) makepkg_conf="$OPTARG" ;;
h|*) usage ;;
esac
done
[[ ! -f PKGBUILD && -z "${install_pkgs[*]}" ]] && die 'This must be run in a directory containing a PKGBUILD.'
+[[ ! -f $makepkg_conf ]] && die "$makepkg_conf does not exist."
check_root "$0" "${orig_argv[@]}"
@@ -307,7 +311,7 @@ fi
umask 0022
load_vars "${XDG_CONFIG_HOME:-$USER_HOME/.config}/pacman/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
-load_vars /etc/makepkg.conf
+load_vars "$makepkg_conf"
# Use PKGBUILD directory if these don't exist
[[ -d $PKGDEST ]] || PKGDEST=$PWD
--
2.9.0