#!/bin/bash # alfplayer # 2014-06-12 # # Prints Parabola PCR packages with the corresponding AUR # packages, only if the version of the Parabola package is older # than the Arch package version. set -e name="aur-vs-pcr" baseconfpath="/etc/libredbdiff" basedbpath="/var/lib/libredbdiff" conffile="$baseconfpath/pacman.conf.parabola" conffilearch="$baseconfpath/pacman.conf.archlinux" dbpath="$basedbpath/pacman.parabola" dbpatharch="$basedbpath/pacman.archlinux" field_pkgname=40 field_version=40 field_time=10 error() { echo -e "Error. $@" > /dev/stderr ; exit 1; } verbose=1 while true ; do if [[ $1 =~ ^(-v|--verbose)$ ]] ; then verbose=0 shift elif [[ $# == 1 && $1 =~ ^(-h|--help)$ ]] ; then echo -e "${name}. Show PCR repository packages that need to be updated from AUR. Usage: ${name} [pattern]\t\tRegular output. ${name} -v [pattern]\t\tAlso print package names of unmatched and updated packages. Specify [pattern] to filter package names. It can be empty to show all PCR packages. Examples: ${name} pkgtool\t\tSearches for package names including the substring \"pkgtool\". ${name} ^emacs.*\t\tSearches for package names starting with \"emacs\". ${name} -v emacs.*\t\tSame as previous but it also prints unmatched and updated packages." exit 0 else pattern="$1" if [[ $2 ]] ; then error "Bad arguments. Nothing done. Run \"aur-vs-pcr -h\" for usage information." else break fi fi done if ! which jshon > /dev/null ; then echo "jshon is not installed (package \"jshon\")" fi # Save PCR package information to a file expac -S '%r/%n %v %b %p' -t '%F' | grep "^pcr" | cut -b 5- | \ awk -v pattern="$pattern" "\$1 ~ pattern" > /tmp/aur-vs-pcr.tmp pkgname_list="$(head -c -1 /tmp/aur-vs-pcr.tmp | awk '{print $1}' | sed ':a;N;$!ba;s/\n/ /g')" declare -Ax ver_arch time_arch maintainer_arch ood_arch provides_string_arch desc_arch pkg_count="$(wc -w <<< "${pkgname_list}")" set +m shopt -s lastpipe # Query using the HTTP AUR RPC about 400 packages at a time. The request is denied using 500. for (( j=0 ; j ${pkgname}" fi fi else if [[ $verbose == 0 ]] ; then echo "o ${pkgname}" fi fi done < /tmp/aur-vs-pcr.tmp