Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Debian MD5 Digests

Reply
Thread Tools

Debian MD5 Digests

 
 
Cousin Stanley
Guest
Posts: n/a
 
      07-27-2004
After 4 failed attempts at installing Debian Linux from CDs
that were burned from downloaded .iso files, I've finally come to
the conclusion that my CD Burner is not working properly ....

The md5 digests of all downloaded .iso files has checked out OK
in each case PRIOR to burning them to CD and in each case
the burned CDs always boot and begin the Debian install proc
which ultimately fails due to md5 errors .....

The Debian installer doesn't present the user
with the opportunity to check CD-ROM integrity
until AFTER the above failures have occurred,
which seems a bit late ....

I wrote a small script to check md5s of the burned CD files
against those in the supplied md5sum.txt file,
but since the burned CD I have is corrupted,
testing the script is somewhat tedious and fails
at different points in processing with the following error
attributed to permissions ....

Traceback (most recent call last):
File "K:\Python\py_Work\file\deb_md5.py", line 76, in ?
that_md5 = md5_digest( this_path )
File "K:\Python\py_Work\file\deb_md5.py", line 53, in md5_digest
xFile = file( xPath , 'rb' ).read()
IOError: [Errno 13] Permission denied

I'm not particularly interested in getting rid of that particular error
as I think/hope it will go away when I get a good CD burn ....

However, I would like to hear from someone
who has a Debian CD with the md5sum.txt file
on it that would test the script and see if it
actually runs all the way to completion ....

Are all the files that are listed in the md5sum.txt file
always included on the CD ????

I added a check for this after seeing file not found errors
in the script ....

# ------------------------------------------------------------------------------------------

import md5 , os , sys

if len( sys.argv ) < 2 :
print ' Usage .......... python deb_md5.py base_path_to_CD'
sys.exit( -1 )

base_path = sys.argv[ 1 ]

if not os.path.exists( base_path ) :
print ' **** Base Path NOT Found ****'
sys.exit( -2 )

os.chdir( base_path )

file_in = file( 'md5sum.txt' , 'r' )

def md5_digest( xPath ) :
xFile = file( xPath , 'rb' ).read()
m = md5.new()
m.update( xFile )
return m.hexdigest()

rec_num = 0

for this_line in file_in :

this_list = this_line.split()

this_md5 = this_list[ 0 ]
this_path = this_list[ 1 ]

rec_num += 1

if os.path.exists( this_path ) :

that_md5 = md5_digest( this_path )

if this_md5 != that_md5 :
print '%4d * MD5 Error * %s ' % ( rec_num , this_path )

else :
print '%4d %s' % ( rec_num , this_path )

else :
print '%4d * Not Found * %s' % ( rec_num , this_path )

file_in.close()

--
Cousin Stanley
Human Being
Phoenix, Arizona

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
create a md5 / md5 passwd with a salt Peter Woodsky Ruby 6 11-21-2008 09:08 AM
md5 from python different then md5 from command line ursache.marius@gmail.com Python 9 05-07-2006 11:49 PM
Matching Java md5 digests douglasforrest@gmail.com Perl Misc 7 02-14-2006 09:31 PM
Bit IO, digests, checksums Igor Planinc Java 15 11-18-2005 10:01 PM
I remember someone asking about an MD5 javascript: http://pajhome.org.uk/crypt/md5/ Mozzie \( v \) Javascript 0 07-12-2004 01:06 PM



Advertisments