diff options
author | Luke Shumaker <lukeshu@parabola.nu> | 2017-02-15 15:56:42 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2018-01-03 14:58:21 -0500 |
commit | 379f740dced3139bd2dc004f9ccaae0c16921e07 (patch) | |
tree | a4a480e4d04fad1fa12b67c97a3df35c48d7354c | |
parent | aedd3438ffdc764a0729b62855b5cb3997f11627 (diff) | |
download | devtools32-379f740dced3139bd2dc004f9ccaae0c16921e07.tar.xz |
makechrootpkg: _chrootbuild: Split into _chroot{prepare,build}
-rw-r--r-- | makechrootpkg.in | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in index d2a0477..301f067 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -205,6 +205,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 declare -p SOURCE_DATE_EPOCH 2>/dev/null || true printf '_chrootbuild "$@" || exit\n' @@ -219,6 +225,20 @@ EOF # These functions aren't run in makechrootpkg, # so no global variables +_chrootprepare() { + # No coredumps + ulimit -c 0 + + # shellcheck source=/dev/null + . /etc/profile + + # Beware, there are some stupid arbitrary rules on how you can + # use "$" in arguments to commands with "sudo -i". ${foo} or + # ${1} is OK, but $foo or $1 isn't. + # https://bugzilla.sudo.ws/show_bug.cgi?id=765 + sudo --preserve-env=SOURCE_DATE_EPOCH -iu builduser bash -c 'cd /startdir; makepkg "$@" --nobuild' -bash "$@" +} + _chrootbuild() { # No coredumps ulimit -c 0 @@ -230,7 +250,7 @@ _chrootbuild() { # use "$" in arguments to commands with "sudo -i". ${foo} or # ${1} is OK, but $foo or $1 isn't. # https://bugzilla.sudo.ws/show_bug.cgi?id=765 - sudo --preserve-env=SOURCE_DATE_EPOCH -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@" + sudo --preserve-env=SOURCE_DATE_EPOCH -iu builduser bash -c 'cd /startdir; makepkg "$@" --noextract --noprepare' -bash "$@" } _chrootnamcap() { @@ -416,6 +436,11 @@ main() { --bind="$PWD:/startdir" \ --bind="$SRCDEST:/srcdest" \ "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \ + /chrootprepare "${makepkg_args[@]}" && + arch-nspawn "$copydir" \ + --bind="$PWD:/startdir" \ + --bind="$SRCDEST:/srcdest" \ + "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \ /chrootbuild "${makepkg_args[@]}" then move_products "$copydir" "$src_owner" |