http://unattended.sourceforge.net/dynamic.php

> There are two things to note about this code. First, it will
> only work with the Linux-based boot disk. And second, I have not
> actually tested it yet. If you try it, please let me know how
> it goes :-).

It almost worked!  Here is what ended up working for me:

use Socket;

...

$u->{'UserData'}->{'ComputerName'} =
    sub {
        my $addr = $u->{'_meta'}->{'ipaddr'};
        defined $addr
            or return undef;
        my $host = gethostbyaddr (inet_aton ($addr), AF_INET);
        if (!defined $host) {
            warn "Unable to gethostbyaddr ($addr): $? $^E\n";
            return undef;
        }
        # Strip off domain portion
        $host =~ s/\.(.*)//;
        print "Found ComputerName (with DNS): $host\n";
        return $host;
    };



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
unattended-info mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unattended-info

Reply via email to