Skip to main content
Topic: To get tar filename of package from the package name (Read 313 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

To get tar filename of package from the package name

How to get the name of tar package file (in cache dir.) from a package name ?

Re: To get tar filename of package from the package name

Reply #1
Code: [Select]
% pkg="/var/cache/pacman/pkg/"$(pacman -Q linux-zen | sed 's/ /-/g')"-x86_64.pkg.tar.zst"; echo $pkg
/var/cache/pacman/pkg/linux-zen-5.17.6.zen1-1-x86_64.pkg.tar.zst
It won't work with 'any' arch packages, e.g. init scripts.

Re: To get tar filename of package from the package name

Reply #2
This one will:
Code: [Select]
pkg='linux-zen'; arch=$(pacman -Qi $pkg | grep Architect | awk '{print $3}'); package="/var/cache/pacman/pkg/"$(pacman -Q $pkg | sed 's/ /-/g')"-$arch.pkg.tar.zst"; echo $package
/var/cache/pacman/pkg/linux-zen-5.17.6.zen1-1-x86_64.pkg.tar.zst
pkg=at-openrc; arch=$(pacman -Qi $pkg | grep Architect | awk '{print $3}'); package="/var/cache/pacman/pkg/"$(pacman -Q $pkg | sed 's/ /-/g')"-$arch.pkg.tar.zst"; echo $package
/var/cache/pacman/pkg/at-openrc-20210506-2-any.pkg.tar.zst