scripting help needed, please

Declan Moriarty declan.moriarty at ntlworld.ie
Sun May 12 01:58:59 PDT 2002


Was it Rob 'Feztaa' Park who wrote on Saturday 11 May 2002 01:08:
> Come on Bill, let's give them what they want ;)
>
> Alas! Declan Moriarty spake thus:
> > I considered scripting for this scenario.
> > I had  the LFS and BLFS tar.gz files in /usr/src. I wrote a backup to
> > cdr. Then I wanted to md5sum or diff the cdr in (/mnt/cdrom) with the lfs
> > src in /usr/src, and delete the ones that checked out okay, and any
> > remaining build directories.
>
> I'd try something like this:
>
> for i in /usr/src/*; do
> j=$(basename "$i")
> isum=$(md5sum "$i"|cut -d " " -f1)
> jsum=$(md5sum /mnt/cdrom/$j|cut -d " " -f1)
> [ "$jsum" -eq "$isum" ] && rm -f "$i"
> done
>
> It's untested, but it should work just fine. It simply gets all the
> md5sums from the files in /usr/src, then it looks in /mnt/cdrom for
> files of the same name and gets their md5sums, then it compares the
> md5sums and deletes the file in /usr/src if it's md5sum matches it's
> counterpart in /mnt/cdrom.


That's excellent Rob, thank you.  I probably placed the bar a little low - it 
wasn't hard enough. I'm building up a wad of tar.gz & tar.bz2 files in 
/usr/src. I'll throw them onto the cd, and let your script run riot, and 
inform you of the results shortly.
-- 
	Regards,


	Declan Moriarty




Applied Researches - Ireland's Foremost Electronic Hardware Genius

	A Slightly Serious(TM) Company

Experience is like a comb, 
that Life gives you - AFTER all your hair has fallen out!
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe blfs-support' in the subject header of the message



More information about the blfs-support mailing list