diff options
author | lesto | 2020-05-17 17:00:29 +0000 |
---|---|---|
committer | lesto | 2020-05-17 17:04:21 +0000 |
commit | bff2c1d01835162cee50b953c3d1dc9cc5d42edf (patch) | |
tree | 1e8d07093c6907d2fccd4265327e35586b89d46f | |
parent | 8272ae8bf8e664f23d93ed7663e7b3a2b9674a2b (diff) | |
download | aur-bff2c1d01835162cee50b953c3d1dc9cc5d42edf.tar.gz |
prepared for automatic update
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | PKGBUILD | 12 | ||||
-rwxr-xr-x | pp.sh | 80 |
3 files changed, 10 insertions, 88 deletions
@@ -1,14 +1,14 @@ pkgbase = pacman-parallelizer pkgdesc = A minimal package downloader for pacman, using aria2 pkgver = 8 - pkgrel = 1 + pkgrel = 2 url = https://github.com/lestofante/PacmanParallelizer arch = any license = GPL3 depends = aria2 depends = pacman-contrib - source = pp.sh - md5sums = 626c0d5518131fcb5e9b151db1e1d93e + source = pacman-parallelizer-8::git+https://github.com/lestofante/PacmanParallelizer.git#tag=8 + sha256sums = SKIP pkgname = pacman-parallelizer @@ -1,22 +1,24 @@ # Maintainer: lesto <lestofante88@gmail.com> + pkgname=pacman-parallelizer pkgver=8 -pkgrel=1 +pkgrel=2 pkgdesc="A minimal package downloader for pacman, using aria2" arch=(any) url="https://github.com/lestofante/PacmanParallelizer" +urlgit="https://github.com/lestofante/PacmanParallelizer.git" license=('GPL3') depends=('aria2' 'pacman-contrib') -source=("pp.sh") -md5sums=('626c0d5518131fcb5e9b151db1e1d93e') +source=("$pkgname-$pkgver"::"git+$urlgit#tag=$pkgver") +sha256sums=('SKIP') build() { - cd "$srcdir" + cd "$srcdir/$pkgname-$pkgver" chmod +x ./pp.sh } package() { - cd "$srcdir" + cd "$srcdir/$pkgname-$pkgver" mkdir -p "$pkgdir/usr/bin" cp pp.sh "$pkgdir/usr/bin" } diff --git a/pp.sh b/pp.sh deleted file mode 100755 index 8efa2e58ba2b..000000000000 --- a/pp.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -arch=$(uname -m) -maxMirrorForDownload=4 -pacmanCahceDir="$(pacman-conf CacheDir)" - -if [[ $UID -ne 0 ]]; then - sudo -p 'Restarting as root, password: ' bash $0 "$@" - exit $? -fi - -#read mirrorlist, "Server =" lines, remove all before and including "= " (10 char) -readarray -t mirrorArray < <(grep "^Server =" /etc/pacman.d/mirrorlist | cut -c 10-) - -mirrorArrayLen=${#mirrorArray[@]} -let maxParallelDownload=$mirrorArrayLen/$maxMirrorForDownload -echo "mirrorsNumber:$mirrorArrayLen maxParallelDownload:$maxParallelDownload maxMirrorForDownload:$maxMirrorForDownload" - -#randomize the order of the mirror -mirrorArray=( $(shuf -e "${mirrorArray[@]}") ) - -#now get the list of stuff to update -readarray -t packageList < <(checkupdates | cut -d ' ' -f 1,4) - -pidToWait=() -pidToWaitStr="" -mirrorIndex=0 -for pkgNameAndVersion in "${packageList[@]}"; do - pkgName=${pkgNameAndVersion% *} - - repoAndArch=($(pacman -Si $pkgName | grep 'Repository :\|Architecture :' | cut -c 19-)) - - repo=${repoAndArch[0]} - archpkg=${repoAndArch[1]} - - downloadList='' - for (( i=0; i<$maxMirrorForDownload; i++ )); do - mirror=${mirrorArray[mirrorIndex]} - pkgNameAndVersion=${pkgNameAndVersion/ /-} - val=${mirror/\$repo/$repo} - val=$(echo ${val/\$arch/$arch}/$pkgNameAndVersion-$archpkg.pkg.tar.zst) - downloadList="$downloadList $val" - ((mirrorIndex++)) - if [[ $mirrorIndex -ge $mirrorArrayLen ]]; then - mirrorIndex=0 - fi - done - - aria2c -c $downloadList --connect-timeout=1 -s $maxMirrorForDownload -t 1 -d "$pacmanCahceDir" &> /dev/null & - pidTmp=($!) - pidToWait+=($pidTmp) - pidToWaitStr+=" $pidTmp" - - running=$(jobs |wc -l) - echo ">>> $(date +%T) | Downloading $pkgName, $running/$maxParallelDownload download" - - while [ $running -ge $maxParallelDownload ]; do - sleep 0.1 #sleep 0.1 second - running=$(jobs |wc -l) - done -done - -#now wait for all remaining jobs -echo "all download started, waiting for completition of pids: ${pidToWaitStr}" - -for pid in "${pidToWait[@]}"; do - echo "waiting for pid $pid" - wait $pid - echo "$pid completed" -done - -if [[ $# -gt 0 ]]; then - echo "downloads complete, calling $1" - #DROP PRIVILEDGES - sudo -s -u $SUDO_USER $1 -Syu --noconfirm -else - echo "downloads complete, calling pacman" - pacman -Syu --noconfirm -fi - |