LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-22-2011, 01:57 AM   #1
Phorize
Member
 
Registered: Sep 2005
Location: UK
Distribution: Slackware
Posts: 226

Rep: Reputation: 29
gpg --verify multiple files


Hi all.

All of the discussion about slackware and kde prompted me to rsync alien's kde 4.6 packages (thanks for these by the way!).

Each directory contains the .txz packages and associated .asc (all same signature)and md5s.

I want to avoid doing gpg --verify whatever.asc individually for multiple files. Likewise for md5sum -c whatever.md5.

Can anyone tell me a nice way of running run gpg --verify and md5sum on all files in the directory? I have been playing with wildcards but can't get it right.

Best,

Kris
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 06-22-2011, 02:02 AM   #2
Thom1b
Member
 
Registered: Mar 2010
Location: France
Distribution: Slackware
Posts: 484

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
Code:
for i in *.asc ; do gpg --verify $i ; done
 
2 members found this post helpful.
Old 06-22-2011, 02:12 AM   #3
Phorize
Member
 
Registered: Sep 2005
Location: UK
Distribution: Slackware
Posts: 226

Original Poster
Rep: Reputation: 29
Quote:
Originally Posted by Thom1b View Post
Code:
for i in *.asc ; do gpg --verify $i ; done
Wow, that was fast. Thank you. This worked like a treat. I am going to dissect your command a bit to understand it. Out of interest, is there any other way of doing it, if so what makes this your preferred way?

Kris
 
Old 06-22-2011, 04:52 AM   #4
Thom1b
Member
 
Registered: Mar 2010
Location: France
Distribution: Slackware
Posts: 484

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
gpg can't verify multiple files, so you just need to "loop" with "for" instruction, and test every .asc files automatically. Each .asc file is stored in "$i" variable, then gpg can verify $i.
It's a basic shell instruction.

Sorry for my bad english.
 
1 members found this post helpful.
Old 06-22-2011, 04:59 AM   #5
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,557

Rep: Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762Reputation: 1762
I would have used GNU Parallel since it would be faster than a loop, given that the verification would run in parallel

ls *.asc | parallel gpg --verify
 
Old 06-22-2011, 05:18 AM   #6
Phorize
Member
 
Registered: Sep 2005
Location: UK
Distribution: Slackware
Posts: 226

Original Poster
Rep: Reputation: 29
Quote:
Originally Posted by Thom1b View Post
gpg can't verify multiple files, so you just need to "loop" with "for" instruction, and test every .asc files automatically. Each .asc file is stored in "$i" variable, then gpg can verify $i.
It's a basic shell instruction.

Sorry for my bad english.
I see. I'll forgive your actually functional english if you can forgive my n00b shell scripting.
 
Old 06-22-2011, 05:26 AM   #7
Phorize
Member
 
Registered: Sep 2005
Location: UK
Distribution: Slackware
Posts: 226

Original Poster
Rep: Reputation: 29
Quote:
Originally Posted by ruario View Post
I would have used GNU Parallel since it would be faster than a loop, given that the verification would run in parallel

ls *.asc | parallel gpg --verify
Thanks, this seems like a nice way of doing this. I was actually messing around with wild cards and piping the output of ls to gpg, but didn't know that it couldn't handle multiple arguements.
 
Old 06-22-2011, 07:06 AM   #8
wadsworth
Member
 
Registered: Aug 2007
Distribution: Slackware64 13.37
Posts: 215

Rep: Reputation: 65
gpg --verify-files *.asc

from the man page:
--verify-files
Identical to --multifile --verify

Or maybe this:
find . -name "*.asc" -exec gpg --verify-files {} +
 
Old 06-22-2011, 07:25 AM   #9
mRgOBLIN
Slackware Contributor
 
Registered: Jun 2002
Location: New Zealand
Distribution: Slackware
Posts: 999

Rep: Reputation: 231Reputation: 231Reputation: 231
I have a script that I've used for some time.

It checks a slackware tree for valid asc files.

You invoke it with
Script [version]

e.g
Code:
gpgcheck.sh 64-13.1
It was a quick hack so no error checking and such but has served me well =)

Code:
#!/bin/sh
# gpgcheck.sh
# Search Slackware tree for gpg sigs and verify them.

(
cd /home/ftp/pub/slackware
find slackware${1}/ -type f -name "*.t?z.asc" -o -iname "*.md5.asc"|while read sig; do
    gpg -v $sig 2>&1
done | awk 'BEGIN {badcount=0;count=0}
                 /assuming/ {print "Checking "$6; file=$6;count++}
                 /BAD/ {print "\nWARNING!!! __BAD__ sig for " file"\n"; badcount++}
            END {print count " Total files with "badcount " Bad sigs"}'
)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you verify my syntax for creating multiple users in a batch file? grayceworks Linux - Newbie 5 03-03-2011 02:04 AM
GPG: Bad session key gpg between gpg on linux and gpg gui on windows XP konqi Linux - Software 1 07-21-2009 09:37 AM
How do you GPG verify all of your rsync slackware directory Old_Fogie Slackware 31 10-24-2006 06:27 AM
Can't verify package gpg signatures on Mandrake 10 ayn Mandriva 0 06-09-2004 07:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration