diff options
-rw-r--r-- | makechrootpkg.in | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in index 8e1fd95..67d2cf8 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -312,6 +312,12 @@ EOF # 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 printf '_chrootbuild "$@" || exit\n' @@ -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 @@ -511,6 +530,11 @@ 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[@]}" \ /chrootbuild "${makepkg_args[@]}" then move_products "$copydir" "$src_owner" |