Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/makechrootpkg.in
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-04-24 11:03:38 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-04-24 11:03:38 -0400
commit7eadec0ab1c0c09c4d940b20d6f88f81a4ab149e (patch)
tree6e1d88dcf869bf567f852c3ea169ff79a8b31ed5 /makechrootpkg.in
parent7358ca574bf6fd133a5d883f2da6e359335ac830 (diff)
parent280d5501b00945fdf4e8de13724ec22b87a41576 (diff)
Merge commit '280d55' into complete
Diffstat (limited to 'makechrootpkg.in')
-rw-r--r--makechrootpkg.in24
1 files changed, 14 insertions, 10 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in
index 244700c..a48f658 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -21,6 +21,7 @@ add_to_db=false
run_namcap=false
chrootdir=
passeddir=
+declare -a install_pkgs
default_copy=$USER
[[ -n $SUDO_USER ]] && default_copy=$SUDO_USER
@@ -66,7 +67,7 @@ while getopts 'hcudr:I:l:n' arg; do
u) update_first=true ;;
d) add_to_db=true ;;
r) passeddir="$OPTARG" ;;
- I) install_pkg="$OPTARG" ;;
+ I) install_pkgs+=("$OPTARG") ;;
l) copy="$OPTARG" ;;
n) run_namcap=true; makepkg_args="$makepkg_args -i" ;;
*) makepkg_args="$makepkg_args -$arg $OPTARG" ;;
@@ -98,7 +99,7 @@ if (( EUID )); then
die 'This script must be run as root.'
fi
-if [[ ! -f PKGBUILD && -z $install_pkg ]]; then
+if [[ ! -f PKGBUILD && -z "${install_pkgs[*]}" ]]; then
die 'This must be run in a directory containing a PKGBUILD.'
fi
@@ -141,17 +142,20 @@ if [[ ! -d $copydir ]] || $clean_first; then
lock_close 8
fi
-if [[ -n $install_pkg ]]; then
- pkgname="${install_pkg##*/}"
- cp "$install_pkg" "$copydir/$pkgname"
+if [[ -n "${install_pkgs[*]}" ]]; then
+ declare -i ret=0
+ for install_pkg in "${install_pkgs[@]}"; do
+ pkgname="${install_pkg##*/}"
+ cp "$install_pkg" "$copydir/$pkgname"
- mkarchroot -r "pacman -U /$pkgname --noconfirm" "$copydir"
- ret=$?
+ mkarchroot -r "pacman -U /$pkgname --noconfirm" "$copydir"
+ (( ret += !! $? ))
- rm "$copydir/$pkgname"
+ rm "$copydir/$pkgname"
+ done
- # Exit early, we've done all we need to
- exit $ret
+ # If there is no PKGBUILD we have done
+ [[ -f PKGBUILD ]] || exit $ret
fi
$update_first && mkarchroot -u "$copydir"