[arch-projects] [devtools] [PATCH] makechrootpkg: Install packages in one step

Jan Alexander Steffens (heftig) jan.steffens at gmail.com
Sat Apr 30 19:51:01 UTC 2016


Avoids having to specify them in dependency order.
---
 makechrootpkg.in | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/makechrootpkg.in b/makechrootpkg.in
index 9534c54..709e824 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -127,19 +127,16 @@ clean_temporary() {
 }
 
 install_packages() {
-	local pkgname
+	local -a pkgnames
+	local ret
 
-	for install_pkg in "${install_pkgs[@]}"; do
-		pkgname="${install_pkg##*/}"
-		cp "$install_pkg" "$copydir/$pkgname"
+	pkgnames=("${install_pkgs[@]##*/}")
 
-		arch-nspawn "$copydir" \
-			"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
-			pacman -U /$pkgname --noconfirm
-		(( ret += !! $? ))
-
-		rm "$copydir/$pkgname"
-	done
+	cp -- "${install_pkgs[@]}" "$copydir/root/"
+	arch-nspawn "$copydir" "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
+		pacman -U --noconfirm -- "${pkgnames[@]/#//root/}"
+	ret=$?
+	rm -- "${pkgnames[@]/#/$copydir/root/}"
 
 	# If there is no PKGBUILD we are done
 	[[ -f PKGBUILD ]] || exit $ret
-- 
2.8.0


More information about the arch-projects mailing list