On 8/2/10, Ken Moffat <zarniwhoo...@googlemail.com> wrote: before uninstalling in case I change my mind. > > Cool. You've obviously been bitten in the past. Based on my script > that runs through my audio, video, and photo files every week to > check if md5s exist, and generate them where they don't, I imagine > this will add a significant amount of time to every install ? >
md5sum does add some seconds, but a few minutes vs. compile time usually doesn't seem too bad. Not all sure how useful it is. I was dreaming of some way to get a list and detect files new vs. modified and can only look in what would be destdir, but here is some little program. It is in perl due to some difficulties getting a manageble date format plus optional md5. Not saying it's great, just dreaming. ... If they only would come up with a patch for "make install" to produce a file list ... #!/usr/bin/perl # explanation: # perldoc "mystat" # assuming name is mystat # or read at end use Digest::MD5; $do_md5 = "n"; for $arg (@ARGV) { # spent lt 5 minutes on params... $do_md5 = "y" if ($arg =~ /^[-]{1,}md5/); $destdir = $arg if ($arg !~ /^-/); } die "No destdir" if (length($destdir) == 0); $cmd = "find $destdir"; if (open(CMD, "$cmd |")) { while (<CMD>) { chomp; if ($_ !~ /^$destdir$/) { $filespec = $_; $filespec =~ s...@^$destdir/@@; push(@filespecs, $filespec); } } } for $filespec (sort(@filespecs)) { # sort was an afterthought $ret = &get_stat("${destdir}/${filespec}"); $ret =~ s...@^$destdir/@@; @pre_x = lstat("/${filespec}"); if (scalar @pre_x == 0) { $ret = "+ " . $ret; } else { $ret = "! " . $ret; } print "$ret\n"; } sub get_stat() { my ($n) = @_; my @s = lstat($n); my $t = ""; my $mm = ""; my @unam = (); my @gnam = (); my $ret = ""; my $md5sum = ""; if (scalar @s == 0) { return $ret; } if ( -f _ ) { $t = "f" } elsif ( -l _ ) { $t = "l" } elsif ( -d _ ) { $t = "d" } elsif ( -b _ ) { $t = "b" } elsif ( -c _ ) { $t = "c" } elsif ( -p _ ) { $t = "p" } elsif ( -S _ ) { $t = "s" } else { $t = "?" } @unam = getpwuid($s[4]); @gnam = getgrgid($s[5]); $mm = $s[2] & 07777; # ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, # $atime,$mtime,$ctime,$blksize,$blocks) $ret = sprintf "%s %s %s %s %o %s %s", $n, $s[7], $t, $s[10], $mm, $unam[0], $gnam[0]; if (($do_md5 eq "y") && ($t eq "f")) { $md5sum = &do_md5($n); if ($md5sum ne "") { $ret .= " " . $md5sum; } } return $ret; } sub do_md5() { my ($fil) = @_; my $md5 = ""; if (open(FILE, $fil)) { binmode(FILE); $md5 = Digest::MD5->new->addfile(*FILE)->hexdigest; close(FILE); } return $md5; } __END__ =pod =head1 NAME mystat =head1 SYNOPSIS mystat $destdir =head1 DESCRIPTION stat files in destdir and detect pre-existing + denotes new file ! denotes pre-existing file maybe add md5sum with parameter --md5 File list fields newness name size type ctime mode user group md5 =head1 example export destd=foo && find {$destd,/tfoo} && echo "------------" && ./mystat $destd foo foo/big foo/big/foo foo/you foo/bar foo/tfoo foo/tfoo/ufu /tfoo /tfoo/ufu ------------ + big 4096 d 1280737263 775 jhalfs jhalfs + big/foo 4 f 1280782110 664 jhalfs jhalfs + you 4 f 1280737152 664 jhalfs jhalfs + bar 4 f 1280737160 664 jhalfs jhalfs ! tfoo 4096 d 1280783341 775 jhalfs jhalfs ! tfoo/ufu 8 f 1280783341 664 jhalfs jhalfs =cut -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page