Hello,

when i was looking for a system to setup the computers at the school of my son 
in a cheap and easy way, i found your project. I was very lucky, because it 
solves my problems, even if i do only know a little of Linux and nothing of 
Perl (sorry, but i�m  supporting a lot of Windows Systems) 

But after a while i realized that i have to find a way to tell the system , 
which drivers to use. 
I know the $oem$\$1 mechanism, but i don�t like it, because it would copy tons 
of files, which i don�t need in the case of having a lot of different drivers. 

I looked in your config.pl and only found a FIXME note.
I think, i have fixed it.

The idea is to have machine-classes,which al need the same set of drivers and 
copy these drivers into c/drv
Below you can see what i have changed. May be it could be done better, but it 
works.

Next problem is how to tell the system, that i don�t have an NTP-Server, 
without getting the Question.

Hope it helps,

Andy

# 
--------------------------------------------------------------------------------------------------
#
#       Directorystrukture in the OS-Directory
#

\\NTINSTALL\INSTALL\OS\W2K4PRO
+---drv
|   \---cpdpen                          (Drivers needed by Compaq Desktop Pro 
EN)
|   |   \---drv
|   |       +---80861132                ( Video )
|   |       +---80862445                ( Sound )
|   |       \---80862449                ( Nic - Intel )
|   |           \---Windows
|   |               \---Drivers
|   |                   \---IA32
|   \---other                           (drivers for some others, here only the 
nic )
|       \---drv
|               \---80862449            ( Nic - Intel ) 
|               \---Windows
|                   \---Drivers
|                       \---IA32
|
\---i386
    \---  ........   ( Standard OS-Media, SP 4 integrated )

# 
--------------------------------------------------------------------------------------------------
#
#       Definitions in unattend.txt
#

"0002A5185E2D","ComputerName","W-EKS006"
"0002A5185E2D","OS_media","w2k4pro"
"0002A5185E2D","DriverPath","z:\os\w2k4pro\drv\cpdpen"

# 
--------------------------------------------------------------------------------------------------
#
#       Results in the unattend.txt
#
        OemPnPDriversPath = "drv\80861132;drv\80862445;drv\80862449"
        

# 
--------------------------------------------------------------------------------------------------
#
#       Changes in config.pl
#
#
#       Subroutines added ( similar found in the Internet for backing up some 
files) and a little bit modified
#
#

sub GetFiles {
    my ($Dir) = @_;
    my (@Files);

    opendir(DIR, $Dir);
    @Files = readdir(DIR);
    closedir(DIR);

    return @Files;
}


sub copydrv {
    my ($SDir) = shift(@_);
    my ($DDir) = shift(@_);
    my (@SFiles, @DFiles, @Dirs, $File);

    # Get the file lists
    @SFiles = GetFiles( dos_to_host ("$SDir"));

    # For each file, possibly copy.
    # For each directory, save list of directories for later.
    foreach (sort(@SFiles))
    {
        # Ignore ".", "..", and hidden files
        next if (/^\./);

        $File = $_;
        # If it is a directory, save it for later.
        # Else, possibly copy now.
        if (-d  dos_to_host ("$SDir\\$File"))
                {
                push(@Dirs, $File);
                }
                else
        {
                copy(dos_to_host ("$SDir\\$File"), dos_to_host 
("$DDir\\$File"));
        }
    }

    # Process the directories
    foreach (sort(@Dirs))
    {
        $File = "$_";
        my $FFile = "$SDir\\$File";
        if (! -d  dos_to_host ("$DDir\\$File"))
        {
            mkdir(dos_to_host ("$DDir\\$File"), 0755);
        }
                print "Now Copy of $FFile \n";
        copydrv("$FFile" ,"$DDir\\$File");
    }
}


# Find all relevant drivers for this machine
$u->push_value ('Unattended', 'OemPnPDriversPath',
    sub {
        my $os_media = $u->{'_meta'}->{'OS_media'};
        defined $os_media
            or return undef;
        my $media_obj = Unattend::WinMedia->new ($os_media);
        defined $media_obj
            or return undef;
        my $os_name = $media_obj->name ();
        my $os_drivers;
        foreach my $lookup ($u->{'_meta'}->{'macaddr'},
                            $u->{'UserData'}->{'ComputerName'},
                            "$os_name",
                            'Default') {
            $os_drivers = CONFIG->lookup_value($lookup, 'DriverPath');
            defined $os_drivers
                and last;
        }
                defined $os_drivers
            or return undef;
        $os_drivers =~ /^All$/i
            and $os_drivers = $os_media . '\\i386\\$oem$\\$1\\';
        $os_drivers =~ /^[a-z]:/i
            or $os_drivers = $os_media . '\\i386\\$oem$\\$1\\' . $os_drivers;
        opendir OSDRIVERS, dos_to_host ($os_drivers)
            or return undef;
        closedir OSDRIVERS;
        my @pnp_driver_dirs = $media_obj->oem_pnp_dirs (1, $os_drivers);
        scalar @pnp_driver_dirs > 0
            or return undef;
        print "...found here some driver directories.\n";
#
#
#       Changes made here, looking if the os_drivers contain a drive-letter 
#
#
       if ($os_drivers =~ /^[a-z]:/i) {
                print "\n *******************************************\n";
                print "Copy $os_drivers to C:\\drv";
                print "\n *******************************************\n";
                # Create C:\drv and subdirectories.
                mkdir dos_to_host ("c:\\drv")
                or die "FAILED: $^E";
                copydrv($os_drivers . "\\drv" , "C:\\drv");
                print "\n *******************************************\n";
                print "Copy of $os_drivers done";
                print "\n *******************************************\n";
                }
        my $drivers = join ';', @pnp_driver_dirs;
        return $drivers;
    });


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
unattended-info mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unattended-info

Reply via email to