summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorlestofante2019-09-08 13:49:52 +0200
committerlestofante2019-09-08 13:49:52 +0200
commit5ee79e3946356f7cb8f620af2520bdd2ec322d03 (patch)
tree94606c259a74ba1b72d91b6d298ab55ca94530f7
parent0e0f7591e42bc95889428573dbcba7681d2f41b1 (diff)
downloadaur-5ee79e3946356f7cb8f620af2520bdd2ec322d03.tar.gz
wait only for aria2, before was waiting for any background child like sudo
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD2
-rwxr-xr-x[-rw-r--r--]pp.sh14
3 files changed, 13 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index ee921b4bb4b..d2fc3116885 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = pacman-parallelizer
pkgdesc = A minimal package downloader for pacman, using aria2
- pkgver = 4
+ pkgver = 5
pkgrel = 1
url = https://github.com/lestofante/PacmanParallelizer
arch = any
diff --git a/PKGBUILD b/PKGBUILD
index a5e31620c97..3f1f3f00877 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,6 +1,6 @@
# Maintainer: lesto <lestofante88@gmail.com>
pkgname=pacman-parallelizer
-pkgver=4
+pkgver=5
pkgrel=1
pkgdesc="A minimal package downloader for pacman, using aria2"
arch=(any)
diff --git a/pp.sh b/pp.sh
index ae9a3468c0d..55db93e6ce9 100644..100755
--- a/pp.sh
+++ b/pp.sh
@@ -22,7 +22,8 @@ mirrorArray=( $(shuf -e "${mirrorArray[@]}") )
#now get the list of stuff to update
readarray -t packageList < <(checkupdates | cut -d ' ' -f 1,4)
-pidToWait=''
+pidToWait=()
+pidToWaitStr=""
mirrorIndex=0
for pkgNameAndVersion in "${packageList[@]}"; do
pkgName=${pkgNameAndVersion% *}
@@ -46,6 +47,9 @@ for pkgNameAndVersion in "${packageList[@]}"; do
done
aria2c -c $downloadList -d "$pacmanCahceDir" &> /dev/null &
+ pidTmp=($!)
+ pidToWait+=$pidTmp
+ pidToWaitStr+=" $pidTmp"
running=$(jobs |wc -l)
echo ">>> $(date +%T) | Downloading $pkgName, $running/$maxParallelDownload download"
@@ -57,8 +61,12 @@ for pkgNameAndVersion in "${packageList[@]}"; do
done
#now wait for all remaining jobs
-echo "all download started, waiting for completition"
-wait
+echo "all download started, waiting for completition ${pidToWaitStr}"
+
+for pid in "${pidToWait[@]}"; do
+ wait -n
+ # do something when a job completes
+done
if [[ $# -gt 0 ]]; then
echo "downloads complete, calling $1"