#!/bin/bash # prints all packages in all cached DBs with Packager: 'Unknown Packager' [[ "$1" ]] && cache_dir=$1 || cache_dir=/var/lib/pacman/sync [[ "$2" ]] && temp_dir=$1 || temp_dir=/tmp for repo_db in $(ls $cache_dir/*.db) do repo_dirname=$(basename $repo_db) repo_dir=$temp_dir/repo_dbs/$repo_dirname mkdir -p $repo_dir tar xf $repo_db --directory $repo_dir/ declare -a pkgs=( $(find $repo_dir/ | xargs grep -ls 'Unknown Packager') ) echo -e "\n$repo_dirname (${#pkgs[*]} packages)" for pkg in ${pkgs[*]} ; do grep -A1 '%NAME%' $pkg | tail -n1 ; done | sort done rm -rf $temp_dir/repo_dbs/