Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts/makepkg.sh.in
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-04-05 17:26:07 -0400
committerAllan McRae <allan@archlinux.org>2021-04-07 22:41:54 +1000
commit2535611d6c3cbf951408c50ab35953efaf32f686 (patch)
treeced97b08051b9d646f10105c81fa58933ec82eb6 /scripts/makepkg.sh.in
parentd6f86594434729b77e9131880738290140086d40 (diff)
makepkg: add PACMAN_AUTH configurable setting for sudo elevation
If specified, this will be used no matter what. If not, then we check if sudo exists and use that, or else fall back on su. Implements FS#32621 Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/makepkg.sh.in')
-rw-r--r--scripts/makepkg.sh.in13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index f4a2de7d..92cb6398 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -225,15 +225,22 @@ missing_source_file() {
}
run_pacman() {
- local cmd
+ local cmd cmdescape
if [[ $1 = -@(T|Q)*([[:alpha:]]) ]]; then
cmd=("$PACMAN_PATH" "$@")
else
cmd=("$PACMAN_PATH" "${PACMAN_OPTS[@]}" "$@")
- if type -p sudo >/dev/null; then
+ cmdescape="$(printf '%q ' "${cmd[@]}")"
+ if (( ${#PACMAN_AUTH[@]} )); then
+ if in_array '%c' "${PACMAN_AUTH[@]}"; then
+ cmd=("${PACMAN_AUTH[@]/\%c/$cmdescape}")
+ else
+ cmd=("${PACMAN_AUTH[@]}" "${cmd[@]}")
+ fi
+ elif type -p sudo >/dev/null; then
cmd=(sudo "${cmd[@]}")
else
- cmd=(su root -c "$(printf '%q ' "${cmd[@]}")")
+ cmd=(su root -c "$cmdescape")
fi
local lockfile="$(pacman-conf DBPath)/db.lck"
while [[ -f $lockfile ]]; do