From 6c26fd8f69f5bd9c77267c294da76f6b08a965c9 Mon Sep 17 00:00:00 2001 From: Thomas Dziedzic Date: Thu, 6 Oct 2011 17:52:26 -0500 Subject: [PATCH 1/2] add multiple -I flag support for makechrootpkg --- makechrootpkg | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/makechrootpkg b/makechrootpkg index a60c9fe..38202ee 100755 --- a/makechrootpkg +++ b/makechrootpkg @@ -16,7 +16,7 @@ WORKDIR=$PWD update_first='0' clean_first='0' -install_pkg='' +install_pkgs=() add_to_db=0 chrootdir='' @@ -52,6 +52,7 @@ usage() { echo '-d Add the package to a local db at /repo after building' echo '-r The chroot dir to use' echo '-I Install a package into the working copy of the chroot' + echo ' You can specify the flag multiple times.' echo '-l The directory to use as the working copy of the chroot' echo ' Useful for maintaining multiple copies.' echo " Default: $default_copy" @@ -65,7 +66,7 @@ while getopts 'hcudr:I:l:' arg; do u) update_first=1 ;; d) add_to_db=1 ;; r) chrootdir="$OPTARG" ;; - I) install_pkg="$OPTARG" ;; + I) install_pkgs+=("$OPTARG") ;; l) copy="$OPTARG" ;; *) MAKEPKG_ARGS="$MAKEPKG_ARGS -$arg $OPTARG" ;; esac @@ -97,7 +98,7 @@ if [ "$EUID" != '0' ]; then exit 1 fi -if [ ! -f PKGBUILD -a -z "$install_pkg" ]; then +if [ ! -f PKGBUILD -a "${#install_pkgs[@]}" -eq 0 ]; then echo 'This must be run in a directory containing a PKGBUILD.' exit 1 fi @@ -154,12 +155,17 @@ if [ ! -d "$copydir" -o "$clean_first" -eq "1" ]; then exec 8>&- fi -if [ -n "$install_pkg" ]; then - pkgname="$(basename "$install_pkg")" - cp "$install_pkg" "$copydir/$pkgname" - mkarchroot -r "pacman -U /$pkgname --noconfirm" "$copydir" +if [ "${#install_pkgs[@]}" -gt 0 ]; then + pkgnames=() + for install_pkg in "${install_pkgs[@]}"; do + pkgnames+=("$(basename "$install_pkg")") + done + cp "${install_pkgs[@]}" "$copydir" + IFS=" " mkarchroot -r "pacman -U ${pkgnames[*]} --noconfirm" "$copydir" ret=$? - rm "$copydir/$pkgname" + for pkgname in "${pkgnames[@]}"; do + rm "$copydir/$pkgname" + done # Exit early, we've done all we need to exit $ret fi -- 1.7.7