Debian MD5 Digests

Discussion in 'Python' started by Cousin Stanley, Jul 27, 2004.

  1. 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
    Cousin Stanley, Jul 27, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Igor Planinc

    Bit IO, digests, checksums

    Igor Planinc, Nov 15, 2005, in forum: Java
    Replies:
    15
    Views:
    661
    Andrey Kuznetsov
    Nov 18, 2005
  2. Replies:
    9
    Views:
    17,056
    John Salerno
    May 8, 2006
  3. Niranjan
    Replies:
    2
    Views:
    235
    Niranjan
    Aug 28, 2008
  4. Luke Kenneth Casson Leighton
    Replies:
    0
    Views:
    453
    Luke Kenneth Casson Leighton
    Dec 31, 2008
  5. Matching Java md5 digests

    , Feb 13, 2006, in forum: Perl Misc
    Replies:
    7
    Views:
    440
Loading...

Share This Page