Changeset 52

Show
Ignore:
Timestamp:
05/02/08 16:38:06 (2 years ago)
Author:
bruno
Message:

- Move conf file into dploy-common
- Use pb_conf functions

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/dploy-common/etc/dploy/dploy.conf

    r43 r52  
    2222# Do we keep kernel / initrd / answer files onto PXE server (in days. 0 = infinitely) 
    2323keepfiles default = 0 
     24 
     25# Logfile 
     26logfile default = /var/log/dploy.log 
  • devel/dploy-dhcp/bin/dploy-add2dhcp

    r51 r52  
    1616use Data::Dumper; 
    1717use ProjectBuilder::Base; 
     18use ProjectBuilder::Conf; 
    1819use Dploy::Base; 
    19  
    20 my $logfile = "/var/log/dploy.err"; 
    21 my $dhcpmain = "/etc/dhcpd.conf"; 
    22 my $dploydir = "/etc/dploy"; 
    2320 
    2421my $dhcpsub = undef; 
     
    7168} 
    7269 
     70my $dploydir = "/etc/dploy"; 
     71pb_conf_add("$dploydir/dploy.conf"); 
     72 
     73my ($log,$dhcp) = pb_conf_get("logfile","pathdhcp"); 
     74my $logfile = $log->{'default'}; 
     75my $dhcpmain = $dhcp->{'default'}; 
     76 
    7377# Mandatory params checks 
    7478$mac = dploy_check_mac($opts{'mac'}); 
  • devel/dploy-pxe/bin/dploy-add2pxe

    r51 r52  
    99 
    1010use strict; 
     11use Pod::Usage; 
     12use Getopt::Long qw(:config auto_abbrev no_ignore_case); 
     13use Data::Dumper; 
    1114use File::Copy; 
    1215use File::Basename; 
    1316use ProjectBuilder::Base; 
     17use ProjectBuilder::Conf; 
    1418use Dploy::Base; 
    1519 
     
    1822my $ksdevice = "eth0"; 
    1923my $prefix = undef; 
     24 
     25pb_syntax_init("dploy-add2pxe Version PBVER-PBREV\n"); 
    2026 
    2127GetOptions("help|?|h" => \$opts{'h'}, 
     
    2935} 
    3036 
     37pb_conf_add("/etc/dploy/dploy.conf"); 
     38 
    3139# Root of the PXE setup 
    32 my $pxe=dploy_get_conf("pathpxe"); 
     40my $pxe=pb_conf_get("pathpxe"); 
     41my $pathpxe = $pxe->{"default"}; 
    3342 
    3443# temporary mountpoint 
     
    3847 
    3948# Check Mac consitency  
    40 my $mac = dploy_check_mac($opt{'mac'}); 
     49my $mac = dploy_check_mac($opts{'mac'}); 
    4150 
    4251my ($scheme, $account, $mrserver, $port, $mrpath) = pb_get_uri($opts{'url'}); 
     
    5362# mount the ISO to get kernel and initrd 
    5463mkdir "$mnt",0755; 
    55 if ($opt{'type'} == "LinuxCOE") { 
    56     pb_system("sudo /bin/mount -o loop $linuxcoe/$iso $mnt","Mounting $linuxcoe/$iso"); 
    57 } else if ($opt{'type'} == "MondoRescue") { 
     64if ($opts{'type'} == "LinuxCOE") { 
     65    my $bn = basename($mrpath); 
     66    unlink("$ENV{'PBTMP'}/$bn"); 
     67    pb_system("cd \$PBTMP ; wget $url","Downloading $url"); 
     68    pb_system("sudo /bin/mount -o loop $ENV{'PBTMP'}/$bn $mnt","Mounting $bn"); 
     69} elsif ($opts{'type'} == "MondoRescue") { 
    5870    pb_system("sudo /bin/mount -t nfs $mrserver:$mrpath $mnt2","Mountig NFS $mrserver:$mrpath"); 
    5971    pb_system("sudo /bin/mount -o loop $mnt2/$prefix-1.iso $mnt","Mounting LOOP $mnt2/$prefix-1.iso"); 
     
    6476 
    6577# Install script will have to check (and create if not existing) /tftpboot/tmp 
    66 copy("$mnt/isolinux/vmlinuz","$pxe/../tmp/$k") or die "Copy failed: $!"; 
    67 copy("$mnt/isolinux/initrd.img","$pxe/../tmp/$i") or die "Copy failed: $!"; 
     78copy("$mnt/isolinux/vmlinuz","$pathpxe/../tmp/$k") or die "Copy failed: $!"; 
     79copy("$mnt/isolinux/initrd.img","$pathpxe/../tmp/$i") or die "Copy failed: $!"; 
    6880 
    6981# Get the Command Line parameters for MondoRescue restoration 
     
    8193# All done with ISO image... umounting 
    8294pb_system("sudo /bin/umount $mnt","Umount ISO image"); 
     95if ($opts{'type'} == "MondoRescue") { 
     96    pb_system("sudo /bin/umount $mnt2","Unmountig NFS $mrserver:$mrpath"); 
     97} 
    8398 
    8499# Updates PXElinux 
    85 open(PXE, "> $pxe/01-$mac") || die "Unable to open $pxe/01-$mac for writing"; 
     100open(PXE, "> $pathpxe/01-$mac") || die "Unable to open $pathpxe/01-$mac for writing"; 
    86101print PXE << "EOF"; 
    87102default local 
     
    98113 
    99114# Customize pxe file depending on Job type submited 
    100 open(PXE, ">> $pxe/01-$mac") || die "Unable to open $pxe/01-$mac for writing"; 
    101 if ($opt{'type'} == "LinuxCOE") { 
     115open(PXE, ">> $pathpxe/01-$mac") || die "Unable to open $pathpxe/01-$mac for writing"; 
     116if ($opts{'type'} == "LinuxCOE") { 
    102117    print PXE "label linuxcoe\n"; 
    103118    print PXE "  kernel linuxcoe/$k\n"; 
    104119    print PXE "  append ksdevice=$ksdevice ks=$ks initrd=linuxcoe/$i text\n"; 
    105120} else { 
    106     print PXE "label mondorecue\n"; 
     121    print PXE "label mondorescue\n"; 
    107122    print PXE "  kernel mondorescue/$k\n"; 
    108123    print PXE "  append $cliparams pxe prefix=$prefix ipconf=$ksdevice:dhcp nfsmount=$mrserver:$mrpath\n";