build: set PATH to a default value when running as root

Setting this for all builds may cause issues with PKGBUILDs depending on
non-standard PATH locations (set in /etc/profile.d). Set a default value
when running elevated, matching setpriv --reset-env and sudo.

Closes #979
pull/1010/head
Alad Wenter 3 months ago
parent 1799d738da
commit bb70a0ab8a
  1. 4
      lib/aur-build

@ -4,6 +4,10 @@
set -o errexit
shopt -s extglob
argv0=build
# Reset path when running elevated (#979)
if [[ $UID == 0 ]]; then
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
fi
machine=$(uname -m)
startdir=$PWD
PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'

Loading…
Cancel
Save