Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl -w =head1 NAME Verify Your Debian Potatoe =head1 AUTHOR crazyinsomniac If it keeps on rainin', =head1 LICENSE the same as that of perl itself (`perl -v') =cut use strict; use Getopt::Std; use Digest::MD5; $|= {on => 'nope'}; use vars qw/ %Opt %Dsp $Vv/; getopts('?hvd:', \%Opt); $Vv = 1 if exists $Opt{v}; # verbosity (errors and bad sums reported b +y default) if( exists $Opt{h} or exists $Opt{'?'} ) { goto FIRST_HELP } elsif( exists $Opt{d} ) { die " Where is your cd !!??\n" unless defined $Opt{d}; # missing arg, you ape chdir $Opt{d} or die "Dang, does the directory '$Opt{d}' really exist?\n"; die "hmm, can't read md5sums.txt for some reason \n" unless -d $Opt{d} and -r $Opt{d}; &loop_it(); goto THEEND } FIRST_HELP: { print<<"#||#"; Hello and welcome to Verify Your Debian Potatoe. This tool relies on the md5sum.txt file being in the root "directory" of said cd, and the sums there being correct. Usage: perl $0 [-?hvd] -? same as below -h prints out this message -v bees verbose (FAILED sums are reported by default) -d /path/to/cd/a/must #||# } sub loop_it { open(FE,'md5sum.txt') or die "Impossible!!! $!"; my %MD5Sums = map { chomp; reverse split /\s\s/; } <FE>; close(FE); for my $file(sort keys %MD5Sums) { print "processing $file \n", if $Vv; open(MDFH,$file) or warn "shit, couldn't open $file, neext\n" +and next; binmode MDFH; # cause I don't know what kind of shit u runnin select undef, undef, undef, 0.45; # cause a lot of cdr(w)s cho +ke up my $md5 = Digest::MD5->new()->addfile(*MDFH)->hexdigest(); if ( $md5 ne $MD5Sums{$file} ) { printf "Oh CRIKEY!! -- it's back to the bakery.\n%s\n%s ** +\n%s\n\n", $file, $MD5Sums{$file}, $md5 } elsif($Vv) { printf "G.oo00OOD!! -- no problem here\n%s\n%s **\n%s\n\n" +, $file, $MD5Sums{$file}, $md5 } } } THEEND: die q{ levee's goin' to break }

In reply to Verify Your Debian Potatoe by crazyinsomniac

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 12:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found