From 5f3b9de5178b6be3bb12390d5fb299594a757844 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 15 Feb 2017 15:56:42 -0500 Subject: makechrootpkg: _chrootbuild: Split into _chroot{prepare,build}. --- makechrootpkg.in | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/makechrootpkg.in b/makechrootpkg.in index 8e1fd95..67d2cf8 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -310,6 +310,12 @@ EOF # This is a little gross, but this way the script is recreated every time in the # working copy + { + printf '#!/bin/bash\n' + declare -f _chrootprepare + printf '_chrootprepare "$@"\n' + } > "$copydir/chrootprepare" + chmod +x "$copydir/chrootprepare" { printf '#!/bin/bash\n' declare -f _chrootbuild @@ -354,7 +360,7 @@ download_sources() { rm -rf "$builddir" } -_chrootbuild() { +_chrootprepare() { # This function isn't run in makechrootpkg, # so no global variables @@ -392,7 +398,20 @@ _chrootbuild() { exit 1 fi - sudo -u builduser makepkg "$@" + sudo -u builduser makepkg "$@" --nobuild +} + +_chrootbuild() { + # This function isn't run in makechrootpkg, + # so no global variables + + . /etc/profile + export HOME=/build + shopt -s nullglob + + cd /startdir + + sudo -u builduser makepkg "$@" --noextract --noprepare } # Usage: move_products $copydir $owner @@ -508,6 +527,11 @@ download_sources "$copydir" "$src_owner" prepare_chroot "$copydir" "$USER_HOME" "$repack" if arch-nspawn "$copydir" \ + --bind-ro="$PWD:/startdir_host" \ + --bind-ro="$SRCDEST:/srcdest_host" \ + "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \ + /chrootprepare "${makepkg_args[@]}" && + arch-nspawn "$copydir" \ --bind-ro="$PWD:/startdir_host" \ --bind-ro="$SRCDEST:/srcdest_host" \ "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \ -- cgit v1.2.3-54-g00ecf