index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Luke Shumaker <lukeshu@parabola.nu> | 2017-05-05 18:41:02 -0400 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-07-14 06:54:28 +0200 |
commit | 3814e4521f1cdf5b452b62efe004d5f40a4da536 (patch) | |
tree | 481b6c9b2ecb7045ba82830d658ad53fd2830bda /makechrootpkg.in | |
parent | b57354ee086c03ce7aacf485850997c37f13baea (diff) |
-rw-r--r-- | makechrootpkg.in | 10 |
diff --git a/makechrootpkg.in b/makechrootpkg.in index 53235ee..3b38ad2 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -253,20 +253,19 @@ _chrootnamcap() { done } -# Usage: download_sources $copydir $src_owner +# Usage: download_sources $copydir $makepkg_user # Globals: # - SRCDEST # - USER download_sources() { local copydir=$1 - local src_owner=$2 + local makepkg_user=$2 local builddir="$(mktemp -d)" chmod 1777 "$builddir" # Ensure sources are downloaded - makepkg_user=${makepkg_user:-$SUDO_USER} - if [[ -n $makepkg_user ]]; then + if [[ "$(id -u "$makepkg_user")" != 0 ]]; then sudo -u "$makepkg_user" env SRCDEST="$SRCDEST" BUILDDIR="$builddir" \ makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o else @@ -333,6 +332,7 @@ main() { [[ ! -f PKGBUILD && -z "${install_pkgs[*]}" ]] && die 'This must be run in a directory containing a PKGBUILD.' [[ -n $makepkg_user && -z $(id -u "$makepkg_user") ]] && die 'Invalid makepkg user.' + makepkg_user=${makepkg_user:-${SUDO_USER:-$USER}} check_root @@ -395,7 +395,7 @@ main() { [[ -f PKGBUILD ]] || return $ret fi - download_sources "$copydir" "$src_owner" + download_sources "$copydir" "$makepkg_user" prepare_chroot "$copydir" "$USER_HOME" "$repack" |