summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--makechrootpkg.in39
1 files changed, 6 insertions, 33 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in
index 6718d13..0d24ac2 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -151,11 +151,7 @@ delete_chroot() {
stat_done
}
-# Usage: install_packages $copydir $pkgs...
install_packages() {
- local copydir=$1
- local install_pkgs=("${@:2}")
-
local -a pkgnames
local ret
@@ -170,16 +166,7 @@ install_packages() {
return $ret
}
-# Usage: prepare_chroot $copydir $HOME $keepbuilddir $run_namcap
-# Globals:
-# - MAKEFLAGS
-# - PACKAGER
prepare_chroot() {
- local copydir=$1
- local USER_HOME=$2
- local keepbuilddir=$3
- local run_namcap=$4
-
[[ $keepbuilddir = true ]] || rm -rf "$copydir/build"
local builduser_uid builduser_gid
@@ -258,13 +245,7 @@ _chrootnamcap() {
done
}
-# Usage: download_sources $copydir $makepkg_user
-# Globals:
-# - SRCDEST
download_sources() {
- local copydir=$1
- local makepkg_user=$2
-
setup_workdir
chown "$makepkg_user:" "$WORKDIR"
@@ -275,15 +256,7 @@ download_sources() {
die "Could not download sources."
}
-# Usage: move_products $copydir $owner
-# Globals:
-# - PKGDEST
-# - LOGDEST
-# - SRCPKGDEST
move_products() {
- local copydir=$1
- local src_owner=$2
-
local pkgfile
for pkgfile in "$copydir"/pkgdest/*; do
chown "$src_owner" "$pkgfile"
@@ -389,10 +362,10 @@ $update_first && arch-nspawn "$copydir" \
pacman -Syu --noconfirm
if [[ -n ${install_pkgs[*]:-} ]]; then
- install_packages "$copydir" "${install_pkgs[@]}"
+ install_packages
ret=$?
- # If there is no PKGBUILD we have done
- [[ -f PKGBUILD ]] || return $ret
+ # If there is no PKGBUILD we are done
+ [[ -f PKGBUILD ]] || exit $ret
fi
if [[ "$(id -u "$makepkg_user")" == 0 ]]; then
@@ -400,9 +373,9 @@ if [[ "$(id -u "$makepkg_user")" == 0 ]]; then
exit 1
fi
-download_sources "$copydir" "$makepkg_user"
+download_sources
-prepare_chroot "$copydir" "$USER_HOME" "$keepbuilddir" "$run_namcap"
+prepare_chroot
if arch-nspawn "$copydir" \
--bind="$PWD:/startdir" \
@@ -410,7 +383,7 @@ if arch-nspawn "$copydir" \
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
/chrootbuild "${makepkg_args[@]}"
then
- move_products "$copydir" "$src_owner"
+ move_products
else
(( ret += 1 ))
fi