Changeset 51 for devel/dploy-pxe


Ignore:
Timestamp:
05/02/08 16:00:33 (4 years ago)
Author:
bruno
Message:
  • Use pb functions in scripts
  • Update of concept doc
  • Check errors in dploy-add2dhcp
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/dploy-pxe/bin/dploy-add2pxe

    r50 r51  
    1818my $ksdevice = "eth0"; 
    1919my $prefix = undef; 
    20 my $mrserver = undef; 
    21 my $mrpath = undef; 
    2220 
    2321GetOptions("help|?|h" => \$opts{'h'}, 
     
    3533 
    3634# temporary mountpoint 
    37 if (not defined $ENV {'TMPDIR'}) { 
    38     $ENV{'TMPDIR'} = "/tmp"; 
    39 } 
    40 my $tmp=tempdir("dploy.XXXXXXXXXX", DIR => $ENV{'TMPDIR'}, CLEANUP => 1); 
    41 my $mnt="$tmp/iso"; 
    42 my $mnt2="$tmp/nfs"; 
     35pb_temp_init(); 
     36my $mnt="$ENV{'PBTMP'}/iso"; 
     37my $mnt2="$ENV{'PBTMP'}/nfs"; 
    4338 
    4439# Check Mac consitency  
    4540my $mac = dploy_check_mac($opt{'mac'}); 
    4641 
    47 # Check URL syntax 
    48 if (defined $opts{'url'}) { 
    49     $url = $opts{'url'}; 
    50 } 
    51  
    52 if ($url !~ /(\w+):\/\/([^\/:]+)(:\d+)?\/(.*)/) { 
    53     print "Syntax: dploy-add2pxe mac URL-TO-ISO\n"; 
    54     exit(-1); 
    55 } 
    56  
    57 # Get Mondorescue values 
    58 $mrserver = dploy_get_url(); 
    59 $mrpath = dploy_get_url(); 
     42my ($scheme, $account, $mrserver, $port, $mrpath) = pb_get_uri($opts{'url'}); 
    6043 
    6144# Get the ID given by LinuxCOE/MondoRescue to prepare kernel/initrd/ks 
     
    7154mkdir "$mnt",0755; 
    7255if ($opt{'type'} == "LinuxCOE") { 
    73     pb_system("sudo /bin/mount -o loop $linuxcoe/$iso $mnt","Error mounting $linuxcoe/$iso"); 
     56    pb_system("sudo /bin/mount -o loop $linuxcoe/$iso $mnt","Mounting $linuxcoe/$iso"); 
    7457} else if ($opt{'type'} == "MondoRescue") { 
    75     pb_system("sudo /bin/mount -t nfs $mrserver:$mrpath $mnt2","Error mountig NFS $mrserver:$mrpath"); 
    76     pb_system("sudo /bin/mount -o loop $mnt2/$prefix-1.iso $mnt","Error mounting LOOP $mnt2/$prefix-1.iso"); 
     58    pb_system("sudo /bin/mount -t nfs $mrserver:$mrpath $mnt2","Mountig NFS $mrserver:$mrpath"); 
     59    pb_system("sudo /bin/mount -o loop $mnt2/$prefix-1.iso $mnt","Mounting LOOP $mnt2/$prefix-1.iso"); 
    7760} else { 
    7861    # Type passed has parameter does not contain a valid value 
     
    8568 
    8669# Get the Command Line parameters for MondoRescue restoration 
     70my $cliparams; 
    8771open(ISOLINUX, "$mnt/isolinux.cfg") || die "Unable to open $mnt/isolinux.cfg for writing"; 
    8872while ( <ISOLINUX> ) { 
    8973    if (/label nuke/) { 
    90         my $cliparams = <ISOLINUX>;     # kernel line 
     74        $cliparams = <ISOLINUX>;        # kernel line 
    9175        $cliparams = <ISOLINUX>;        # append line 
    9276    } 
     
    9680close ISOLINUX; 
    9781# All done with ISO image... umounting 
    98 pb_system("sudo /bin/umount $mnt","Error umount ISO image); 
     82pb_system("sudo /bin/umount $mnt","Umount ISO image"); 
    9983 
    10084# Updates PXElinux 
Note: See TracChangeset for help on using the changeset viewer.