[distcc] Bootable distcc node

Justin Randall logic at jrlogic.dyndns.org
Tue Mar 16 20:49:29 GMT 2004


On Tuesday 16 March 2004 01:25 pm, daPlumber wrote:
> > From: Lisa Seelye
> > Sent: Tuesday, March 16, 2004 12:54
> >
> > On Tue, 2004-03-16 at 12:00, daPlumber wrote:
> > > The advantage is that if one has temporary access to a
> >
> > bunch of desktops,
> >
> > > which are usually running Windows, a boot-able cd would be
> >
> > ideal combined
> >
> > > with the distcc "search" script (PERL) :
> >
> > http://dev.gentoo.org/~lisa/distcc/distcc-subnetscan/distcc-su
> > bnetscan.pl
> >
> > I would be surprised if that script still worked.  You can
> > take it as a
> > starting point for expansion, but in reality it was just
> > written to see
> > if it could be done.  The task of scanning could be done a lot faster
> > with nmap.  So don't put all your eggs into that script, for
> > it may not
> > work.
> >
> > ymmv.
>
> You mean something like:
>
> nmap -sT -n -p 3632 -oG - 192.168.0.0/24 | grep open | cut -f2 -d" "  | tr
> [:space:] " " >/etc/distcc/hosts
>
> :-)
>
> I still can't find an elegant way of extracting the network/mask from a
> system either. <sigh>
>
> I'm hopeless with PERL, but ugly shell scripts are a specialty... :-)
>

I'm also hopeless with perl, but here's a perlified version suitable for use during system startup, after network is available, to generate a distcc/hosts file, AND it ensures that all hosts discovered are also running the same version of gcc.
It would be nice of a real perl guru could fix this up:


#!/bin/env perl

use strict;

my $scanText = `nmap -sT -n -p 3632 -oG - $ARGV[0] | grep open | cut -f2 -d\" \"  | tr [:space:] \" \"`;

my @hostList = split(' ', $scanText);

open(OUTFILE, ">/tmp/tmp.c");
print OUTFILE "int main(int argc, char ** argv) { return 0; }";
close(OUTFILE);

my $myCCVer = `gcc -dumpversion`;
push(my @validHosts, "localhost");

for my $host(@hostList)
{
	my $remoteVersion = `DISTCC_HOSTS="$host" CCACHE_DISABLE='1' DISTCC_FALLBACK='0' distcc -dumpversion -c /tmp/tmp.c 2>/dev/null`;
	if($remoteVersion == $myCCVer)
	{
		push(@validHosts, $host);
	}
}


for my $goodHost(@validHosts)
{
	print "$goodHost\n";
}



More information about the distcc mailing list