summaryrefslogtreecommitdiff
path: root/src/chroot-tools/libremakepkg
diff options
context:
space:
mode:
Diffstat (limited to 'src/chroot-tools/libremakepkg')
-rwxr-xr-xsrc/chroot-tools/libremakepkg32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg
index 45f57ea..5494202 100755
--- a/src/chroot-tools/libremakepkg
+++ b/src/chroot-tools/libremakepkg
@@ -33,6 +33,7 @@ NONET=true # can be changed with the -N flag
# {SRC,LOG,PKG}DEST set at runtime by makepkg.conf
# MAKEFLAGS, PACKAGER set at runtime by makepkg.conf
# LIBREUSER, LIBREHOME are set by conf.sh
+librechroot_flags=()
# Hooks ########################################################################
@@ -89,23 +90,21 @@ add_to_local_repo() {
build() (
local copydir=$1; shift
- local cmd=(/chrootbuild "$@")
-
- run_hook pre_build "$copydir"
- trap "run_hook post_build '$copydir'" EXIT
local netflag=''
+ local run=()
if $INCHROOT; then
- ! $NONET || netflag='-n'
- unshare $netflag -- "${cmd[@]}"
- else
! $NONET || netflag='-N'
- librechroot $netflag \
- -r "$PWD:/startdir_host" \
- -r "$SRCDEST:/srcdest_host" \
- -l "$copydir" \
- run "${cmd[@]}"
+ run=(unshare)
+ else
+ ! $NONET || netflag='-n'
+ run=(librechroot "${librechroot_flags[@]}" run)
fi
+
+ "${run[@]}" /chrootprepare "$@"
+ run_hook pre_build "$copydir"
+ trap "run_hook post_build '$copydir'" EXIT
+ "${run[@]}" /chrootbuild "$@"
)
# The main program #############################################################
@@ -211,6 +210,13 @@ main() {
MAKEFLAGS="$(get_conf_makepkg MAKEFLAGS '')"
PACKAGER="$(get_conf_makepkg PACKAGER '')"
+ librechroot_flags=(
+ -r "$PWD:/startdir_host"
+ -r "$SRCDEST:/srcdest_host"
+ -n "$CHROOT"
+ -l "$copy"
+ )
+
# OK, we are starting now ##############################################
if $INCHROOT; then
@@ -221,7 +227,7 @@ main() {
lock 9 "$copydir.lock" \
"Waiting for existing lock on chroot copy to be released: [%s]" "$copy"
# Create the chroot if it does not exist
- librechroot -n "$CHROOT" -l "$copy" make
+ librechroot "${librechroot_flags[@]}" make
fi
# Set target CARCH