Now that the DBD::mysql module has been fixed I can start implementing my 
vision of storing configuration information in a mysql relational database.  
  
Using mysql database offers many benefits:  
  
1.  You can use a web-based application to update/query clients hardware &  
software information.  
  
2. You can make the deployment process a lot more automated.  For instance, 
disk partitioning details can be stored and later retrieved by the install.pl  
script.  
  
3.  You can use a web-based application to monitor the deployment status of 
each client PC in realtime.  
  
  
4.  You can remotely manage and monitor your 'unattended' clients from 
virtually anywhere.  
  
  
So far I have done the following:  
  
I created a simple sql script to create a mysql database called unattended. In  
this database, I created the hardware table and populate it with sample data. 
See the code below.  You can modify this script then use the  mysql command as 
follows add both database and table to your mysql database:  
  
mysql -u root -p < unattended.sql  
  
  
Next, I hacked the site/config.pl file so that it querys the hardware table  
to get the owner's name, computername, and organization info.  The bulk of the 
work is performed by the gethwinfo function. I could make this code a bit more  
efficient by getting all the required information during a single mysql  
connection. e.g.  
  
my (owner, computername, organization) = $dbh->selectrow_array("SELECT owner,  
computername, organization FROM hardware where mac_address='$mac' LIMIT 1");  
  
But, I didn't want to change the original code logic too drastically..  
The modified files are attached.  Hack away!  
  
Regards,  
TJ  
  
  
# --------------------------------------------------------  
# unattended.sql - This script will create the unattended database and the   
# hardware table.  The hardware table will be populated with sample (or real)   
# data. Finally the appropriate permission will be granted to the risetup 
#account.  
# Change the values as you see fit for your needs.  
  
DROP DATABASE IF EXISTS unattended;  
CREATE DATABASE unattended;  
USE unattended;  
  
  
#  
# Table structure for table 'hardware'  
#   
  
DROP TABLE IF EXISTS hardware;  
CREATE TABLE hardware (  
  mac_address varchar(13) NOT NULL default '',  
  computername varchar(32) NOT NULL default '',  
  owner varchar(32) NOT NULL default '',  
  organization varchar(50) NOT NULL default ''  
) TYPE=MyISAM;  
  
# Note, you can add additional fields to hardware table if you wish.  
  
  
#  
# Adding records to table 'hardware'  
#  
  
INSERT INTO hardware (mac_address, computername, owner, organization)  
VALUES("00508BD54555", "Samauri", "Tom Cruise", "Universal");  
INSERT INTO hardware (mac_address, computername, owner, organization)  
VALUES("0007B9011D44", "PulpFiction", "Samuel L. Jackson", "Paramount");  
INSERT INTO hardware (mac_address, computername, owner, organization)  
VALUES("00E018AFA199", "Catwoman", "Halle Berry", "Universal");  
INSERT INTO hardware (mac_address, computername, owner, organization)  
VALUES("00B0D0B64339", "SwordFish", "John Travolta", "Paramount");  
INSERT INTO hardware (mac_address, computername, owner, organization)  
VALUES("005080F5066C", "Apollo", "Tom Hanks", "Fox");  
  
# Grant appropriate access to the database  
GRANT ALL ON unattended.* TO risetup IDENTIFIED BY 'secret';  
  
#----------- end of script---------------------  
  
  
#---- code snippet for the gethwinfo function---  
sub gethwinfo ($) {  
    my ($val) = @_;  
    my $mac = $u->{'_meta'}->{'macaddr'};  
        defined $mac or return undef;  
    my $db="unattended";  
    my $host="galaxy";  
    my $user="risetup";  
    my $password="secret";        
    my $dbh   = DBI->connect ("DBI:mysql:database=$db:host=$host",  
                          $user,  
                          $password)   
                          or die "Can't connect to database: $DBI::errstr\n";  
  
     my $ret = $dbh->selectrow_array("SELECT $val FROM hardware where  
mac_address='$mac' LIMIT 1");  
     $dbh->disconnect();           
     return $ret;  
    }  
#---- end of code snippet--------  
  
  
  
  
  
  
  
----- Original Message -----  
From: "Patrick J. LoPresti" <[EMAIL PROTECTED]>  
Date: 16 Aug 2004 17:19:09 -0400  
To: [EMAIL PROTECTED]  
Subject: [Unattended] Unattended 4.4b released  
  
> Fix for broken DHCP option 233 handling and missing "Perl is missing"  
> diagnostic.  And DBD::mysql module might actually work now.  Also some  
> random cleanups from Shad.  
>   
> This release should be pretty solid.  
>   
> NEWS.txt entry appended.  
>   
>  - Pat  
>   
>   
> ** Changes in version 4.4b (2004-Aug-16)  
>   
> (Linux) Fix bug, introduced in 4.4, which broke DHCP option 233  
> processing (our sample options in the PXELINUX/ISOLINUX config file  
> were overriding DHCP).  
>   
> Fix perl.bat to actually display a diagnostic when ActivePerl is  
> missing, rather than simply printing "Press any key to continue" and  
> halting.  
>   
> Move "check" and "prepare" scripts from install/ to install/tools.  
> Have "prepare" force filenames to lower-case.  
>   
> Clean up URLs in download scripts.  
>   
> (Linux) Make DBD::mysql module actually work.  
>   
> Update OpenOffice to 1.1.2.  
>   
>   
> -------------------------------------------------------  
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media  
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33  
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.  
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285  
> _______________________________________________  
> unattended-info mailing list  
> [EMAIL PROTECTED]  
> https://lists.sourceforge.net/lists/listinfo/unattended-info  
>   
  
-- 
_______________________________________________
Find what you are looking for with the Lycos Yellow Pages
http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10

Attachment: unattended.sql
Description: Binary data

Attachment: dbi-config.pl
Description: Binary data

Reply via email to