Artix Linux Forum

Artix Linux => Package management => Topic started by: mardiyah on 30 April 2023, 14:45:38

Title: To get tar filename of package from the package name
Post by: mardiyah on 30 April 2023, 14:45:38
How to get the name of tar package file (in cache dir.) from a package name ?
Title: Re: To get tar filename of package from the package name
Post by: nous on 30 April 2023, 21:05:43
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.
Title: Re: To get tar filename of package from the package name
Post by: nous on 30 April 2023, 21:13:01
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