Changeset 52
- Timestamp:
- 05/02/08 16:38:06 (2 years ago)
- Files:
-
- devel/dploy-common/etc (moved) (moved from devel/dploy-pxe/etc)
- devel/dploy-common/etc/dploy/dploy.conf (modified) (1 diff)
- devel/dploy-dhcp/bin/dploy-add2dhcp (modified) (2 diffs)
- devel/dploy-pxe/bin/dploy-add2pxe (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/dploy-common/etc/dploy/dploy.conf
r43 r52 22 22 # Do we keep kernel / initrd / answer files onto PXE server (in days. 0 = infinitely) 23 23 keepfiles default = 0 24 25 # Logfile 26 logfile default = /var/log/dploy.log devel/dploy-dhcp/bin/dploy-add2dhcp
r51 r52 16 16 use Data::Dumper; 17 17 use ProjectBuilder::Base; 18 use ProjectBuilder::Conf; 18 19 use Dploy::Base; 19 20 my $logfile = "/var/log/dploy.err";21 my $dhcpmain = "/etc/dhcpd.conf";22 my $dploydir = "/etc/dploy";23 20 24 21 my $dhcpsub = undef; … … 71 68 } 72 69 70 my $dploydir = "/etc/dploy"; 71 pb_conf_add("$dploydir/dploy.conf"); 72 73 my ($log,$dhcp) = pb_conf_get("logfile","pathdhcp"); 74 my $logfile = $log->{'default'}; 75 my $dhcpmain = $dhcp->{'default'}; 76 73 77 # Mandatory params checks 74 78 $mac = dploy_check_mac($opts{'mac'}); devel/dploy-pxe/bin/dploy-add2pxe
r51 r52 9 9 10 10 use strict; 11 use Pod::Usage; 12 use Getopt::Long qw(:config auto_abbrev no_ignore_case); 13 use Data::Dumper; 11 14 use File::Copy; 12 15 use File::Basename; 13 16 use ProjectBuilder::Base; 17 use ProjectBuilder::Conf; 14 18 use Dploy::Base; 15 19 … … 18 22 my $ksdevice = "eth0"; 19 23 my $prefix = undef; 24 25 pb_syntax_init("dploy-add2pxe Version PBVER-PBREV\n"); 20 26 21 27 GetOptions("help|?|h" => \$opts{'h'}, … … 29 35 } 30 36 37 pb_conf_add("/etc/dploy/dploy.conf"); 38 31 39 # Root of the PXE setup 32 my $pxe=dploy_get_conf("pathpxe"); 40 my $pxe=pb_conf_get("pathpxe"); 41 my $pathpxe = $pxe->{"default"}; 33 42 34 43 # temporary mountpoint … … 38 47 39 48 # Check Mac consitency 40 my $mac = dploy_check_mac($opt {'mac'});49 my $mac = dploy_check_mac($opts{'mac'}); 41 50 42 51 my ($scheme, $account, $mrserver, $port, $mrpath) = pb_get_uri($opts{'url'}); … … 53 62 # mount the ISO to get kernel and initrd 54 63 mkdir "$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") { 64 if ($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") { 58 70 pb_system("sudo /bin/mount -t nfs $mrserver:$mrpath $mnt2","Mountig NFS $mrserver:$mrpath"); 59 71 pb_system("sudo /bin/mount -o loop $mnt2/$prefix-1.iso $mnt","Mounting LOOP $mnt2/$prefix-1.iso"); … … 64 76 65 77 # Install script will have to check (and create if not existing) /tftpboot/tmp 66 copy("$mnt/isolinux/vmlinuz","$p xe/../tmp/$k") or die "Copy failed: $!";67 copy("$mnt/isolinux/initrd.img","$p xe/../tmp/$i") or die "Copy failed: $!";78 copy("$mnt/isolinux/vmlinuz","$pathpxe/../tmp/$k") or die "Copy failed: $!"; 79 copy("$mnt/isolinux/initrd.img","$pathpxe/../tmp/$i") or die "Copy failed: $!"; 68 80 69 81 # Get the Command Line parameters for MondoRescue restoration … … 81 93 # All done with ISO image... umounting 82 94 pb_system("sudo /bin/umount $mnt","Umount ISO image"); 95 if ($opts{'type'} == "MondoRescue") { 96 pb_system("sudo /bin/umount $mnt2","Unmountig NFS $mrserver:$mrpath"); 97 } 83 98 84 99 # Updates PXElinux 85 open(PXE, "> $p xe/01-$mac") || die "Unable to open $pxe/01-$mac for writing";100 open(PXE, "> $pathpxe/01-$mac") || die "Unable to open $pathpxe/01-$mac for writing"; 86 101 print PXE << "EOF"; 87 102 default local … … 98 113 99 114 # Customize pxe file depending on Job type submited 100 open(PXE, ">> $p xe/01-$mac") || die "Unable to open $pxe/01-$mac for writing";101 if ($opt {'type'} == "LinuxCOE") {115 open(PXE, ">> $pathpxe/01-$mac") || die "Unable to open $pathpxe/01-$mac for writing"; 116 if ($opts{'type'} == "LinuxCOE") { 102 117 print PXE "label linuxcoe\n"; 103 118 print PXE " kernel linuxcoe/$k\n"; 104 119 print PXE " append ksdevice=$ksdevice ks=$ks initrd=linuxcoe/$i text\n"; 105 120 } else { 106 print PXE "label mondore cue\n";121 print PXE "label mondorescue\n"; 107 122 print PXE " kernel mondorescue/$k\n"; 108 123 print PXE " append $cliparams pxe prefix=$prefix ipconf=$ksdevice:dhcp nfsmount=$mrserver:$mrpath\n";
