]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
pakfire: Properly check if we have our key with our fingerprint
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 12 Dec 2017 19:40:01 +0000 (19:40 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 12 Dec 2017 19:40:01 +0000 (19:40 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/lib/functions.pl

index f7f9d346c8ff7d02dcd49f14754c14f1e404e1a3..0bf702e5b0f5618c15348f95910313dba9949d3c 100644 (file)
@@ -901,16 +901,15 @@ sub senduuid {
 
 sub checkcryptodb {
        logger("CRYPTO INFO: Checking GnuPG Database");
-       my $ret = system("gpg --list-keys | grep -q $myid");
-       unless ( "$ret" eq "0" ) {
-               message("CRYPTO WARN: The GnuPG isn't configured correctly. Trying now to fix this.");
-               message("CRYPTO WARN: It's normal to see this on first execution.");
-               message("CRYPTO WARN: If this message is being shown repeatedly, check if time and date are set correctly, and if IPFire can connect via port 11371 TCP.");
-               my $command = "gpg --keyserver pgp.ipfire.org --always-trust --status-fd 2";
-               system("$command --recv-key $myid >> $Conf::logdir/gnupg-database.log 2>&1");
-       } else {
-               logger("CRYPTO INFO: Database is okay");
-       }
+       system("gpg --fingerprint $myid >/dev/null");
+       return if ($? == 0);
+
+       message("CRYPTO WARN: The GnuPG isn't configured correctly. Trying now to fix this.");
+       message("CRYPTO WARN: It's normal to see this on first execution.");
+       message("CRYPTO WARN: If this message is being shown repeatedly, check if time and date are set correctly, and if IPFire can connect via port 11371 TCP.");
+
+       my $command = "gpg --keyserver pgp.ipfire.org --always-trust --status-fd 2";
+       system("$command --recv-key $myid >> $Conf::logdir/gnupg-database.log 2>&1");
 }
 
 sub callback {