diff options
author | David Runge <dave@sleepmap.de> | 2022-03-16 16:05:49 +0100 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2022-03-16 16:24:14 +0100 |
commit | e9da2e4a7170871297c892aa89402c4cf1dccb84 (patch) | |
tree | 22b033aa2adc59786254fc54e9efeb1107ce699c /.config/zsh/includes | |
parent | 351dd40ca7d765b6630471cfd65cc7c1b3f340ef (diff) | |
download | dotfiles-e9da2e4a7170871297c892aa89402c4cf1dccb84.tar.gz dotfiles-e9da2e4a7170871297c892aa89402c4cf1dccb84.tar.bz2 dotfiles-e9da2e4a7170871297c892aa89402c4cf1dccb84.tar.xz dotfiles-e9da2e4a7170871297c892aa89402c4cf1dccb84.zip |
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.
Diffstat (limited to '.config/zsh/includes')
-rw-r--r-- | .config/zsh/includes/functions.zsh | 17 |
1 files changed, 17 insertions, 0 deletions
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 > |