blanky
March 21st, 2007, 04:42 AM
Hey guys I'm working on a Subversion revision downloader for my game. Basically, I want it to check if there are updates and if there are download them. My server has a cron job that checks out the latest revision of my game's media content and packages it up using the zip program. At first I was thinking about also creating md5hash files and then having my script check the md5 of each local package and the md5 of each remote package, but as I soon learned, each time I zipped, whether or not I changed anything, the md5 hash was different.
So after some tinkering, I finally settled on the following idea. Before my server would zip the packages, it would run an md5 hash on every file in the folders I would zip with something like this (recursively):
find -type f | sed '/.*svn.*/d' | xargs md5sum > md5hash
The sed part is to avoid the subversion specific stuff.
Anyways, I then would md5sum the actual output file, so I'd:
md5sum md5hash > nameofzip.md5
To keep the file small, that is. I would then download the zip. I'd then run my script and have it read the nameofzip.md5 md5hash of the zip I'm checking and compare it to the one inside my zip archive. If they were different, then I'd wget it.
I have the same problems though. Say I take a hash of all the files, I then zip it. Well, the next time I go to take a hash of all the files, it's different. And yes, I haven't modified the files in any way.
I've been at this for a long time, I'm really desperate and going crazy, do you guys know what I could be doing wrong? Sorry if I'm not being very clear, I'm really tired of repeating myself over and over again to no avail, so if something didn't seem clear please tell me and I'll clarify.
So after some tinkering, I finally settled on the following idea. Before my server would zip the packages, it would run an md5 hash on every file in the folders I would zip with something like this (recursively):
find -type f | sed '/.*svn.*/d' | xargs md5sum > md5hash
The sed part is to avoid the subversion specific stuff.
Anyways, I then would md5sum the actual output file, so I'd:
md5sum md5hash > nameofzip.md5
To keep the file small, that is. I would then download the zip. I'd then run my script and have it read the nameofzip.md5 md5hash of the zip I'm checking and compare it to the one inside my zip archive. If they were different, then I'd wget it.
I have the same problems though. Say I take a hash of all the files, I then zip it. Well, the next time I go to take a hash of all the files, it's different. And yes, I haven't modified the files in any way.
I've been at this for a long time, I'm really desperate and going crazy, do you guys know what I could be doing wrong? Sorry if I'm not being very clear, I'm really tired of repeating myself over and over again to no avail, so if something didn't seem clear please tell me and I'll clarify.