From e9da2e4a7170871297c892aa89402c4cf1dccb84 Mon Sep 17 00:00:00 2001 From: David Runge Date: Wed, 16 Mar 2022 16:05:49 +0100 Subject: zsh: Helper function for package lookup by PGP key ID .config/zsh/includes/functions.zsh: Add function to lookup all packages signed by a given PGP key ID. --- .config/zsh/includes/functions.zsh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to '.config/zsh/includes') diff --git a/.config/zsh/includes/functions.zsh b/.config/zsh/includes/functions.zsh index 7a87bee..6f08e59 100644 --- a/.config/zsh/includes/functions.zsh +++ b/.config/zsh/includes/functions.zsh @@ -395,4 +395,21 @@ function pasters() { curl --data-binary @"${file}" https://paste.rs } +function pkg_keyid_lookup() { + # lookup all packages signed by a given PGP key ID (either 16 or 40 chars long) + local key_id="$1" + local key_id_length=${#key_id} + + if (( $key_id_length == 40 )); then + key_id=${key_id[25,40]} + key_id_length=${#key_id} + fi + + if (( $key_id_length != 16 )); then + printf "Key ID is not 40 or 16 chars long: %s\n" $key_id + return 1 + fi + + pacman -Sii | grep $key_id -B20 | grep Name |awk '{print $(NF)}' +} # FUNCTIONS > -- cgit v1.2.3-70-g09d2