summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2017-02-15 15:56:42 -0500
committerLuke Shumaker <lukeshu@parabola.nu>2017-05-05 18:31:17 -0400
commit908701aac4f56c537c49dcb7a1c63fe935ab084c (patch)
tree7c505054ab125a0ee9509967faa6c3dac18c0f57
parent4fab63687915d9bab8ef2688a4f91f07df3bcdc9 (diff)
downloaddevtools32-908701aac4f56c537c49dcb7a1c63fe935ab084c.tar.xz
makechrootpkg: _chrootbuild: Split into _chroot{prepare,build}.
-rw-r--r--makechrootpkg.in23
1 files changed, 22 insertions, 1 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in
index ffe6e42..6ee8457 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -227,6 +227,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'
@@ -240,6 +246,16 @@ EOF
# These functions aren't run in makechrootpkg,
# so no global variables
+_chrootprepare() {
+ # 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 -iu builduser bash -c 'cd /startdir; makepkg "$@" --nobuild' -bash "$@"
+}
+
_chrootbuild() {
# shellcheck source=/dev/null
. /etc/profile
@@ -247,7 +263,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 -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
+ sudo -iu builduser bash -c 'cd /startdir; makepkg "$@" --noextract --noprepare' -bash "$@"
}
_chrootnamcap() {
@@ -409,6 +425,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"