Skip to content

Commit

Permalink
Fixed error in keyfile check
Browse files Browse the repository at this point in the history
  • Loading branch information
ameinild committed Jul 25, 2022
1 parent 1037895 commit cd78591
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions add-apt-key
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh

# Add APT key script
# Version : 1.1.1-6
# Release : 2022-07-07
# Version : 1.1.2-7
# Release : 2022-07-25
# Author : Artur Meinild

# Initial configuration variables
Expand Down Expand Up @@ -195,7 +195,7 @@ case $(file "$tmppath/$tmpfile") in
[ -f "$tmppath/temp-keyring.gpg~" ] && rm "$tmppath/temp-keyring.gpg~"
;;
# Public ring (v4)
*'PGP/GPG key public ring (v4)'*)
*'OpenPGP Public Key Version 4'*)
cp "$tmppath/$tmpfile" "$tmppath/$tmpfile.gpg"
;;
*)
Expand All @@ -209,9 +209,9 @@ if [ ! -f "$tmppath/$tmpfile.gpg" ]; then
fi

# Check if keyfile is the right type
keyfiletype=$(file "$tmppath/$tmpfile.gpg" | grep -oh 'OpenPGP Public Key Version 4')
keyfiletype=$(file "$tmppath/$tmpfile.gpg" | grep -c 'OpenPGP Public Key Version 4')

if [ "$keyfiletype" != "OpenPGP Public Key Version 4" ]; then
if [ "$keyfiletype" -eq 0 ]; then
exit_error "keyfile is not a PGP/GPG key public ring"
fi

Expand Down

0 comments on commit cd78591

Please # to comment.