Skip to content

Instantly share code, notes, and snippets.

@cicku
Created October 23, 2023 04:35
Show Gist options
  • Save cicku/3a0df5c458dddf584858a3f2c8cafd8e to your computer and use it in GitHub Desktop.
Save cicku/3a0df5c458dddf584858a3f2c8cafd8e to your computer and use it in GitHub Desktop.
#!/bin/bash -e
. /etc/makepkg.conf
PKGCACHE=$((grep -m 1 '^CacheDir' /etc/pacman.conf || echo 'CacheDir = /var/cache/pacman/pkg') | sed 's/CacheDir = //')
pkgdirs=("$@" "$PKGDEST" "$PKGCACHE")
while read -r -a parampart; do
pkgname="${parampart[0]}-${parampart[1]}-*.pkg.tar.{xz,zst}"
for pkgdir in ${pkgdirs[@]}; do
pkgpath="$pkgdir"/$pkgname
[ -f $pkgpath ] && { echo $pkgpath; break; };
done || echo ${parampart[0]} 1>&2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment