mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-29 17:23:08 +00:00
Fix the formatting of the file to use 3 spaces instead of tab
This commit is contained in:
parent
d73b02386a
commit
726d4d35f1
@ -15,39 +15,34 @@ sub handled_commands {
|
||||
sub process_request {
|
||||
my $request = shift;
|
||||
my $callback = shift;
|
||||
#my $sitetab = xCAT::Table->new('site');
|
||||
my $serialport;
|
||||
my $serialspeed;
|
||||
my $serialflow;
|
||||
my $initrd_file = undef;
|
||||
my $xcatdport = 3001;
|
||||
#if ($sitetab) {
|
||||
#my $portent = $sitetab->getAttribs({key=>'defserialport'},'value');
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("defserialport");
|
||||
my $t_entry = $entries[0];
|
||||
if ( defined($t_entry) ) {
|
||||
$serialport=$t_entry;
|
||||
}
|
||||
#$portent = $sitetab->getAttribs({key=>'defserialspeed'},'value');
|
||||
@entries = xCAT::TableUtils->get_site_attribute("defserialspeed");
|
||||
$t_entry = $entries[0];
|
||||
if ( defined($t_entry) ) {
|
||||
$serialspeed=$t_entry;
|
||||
}
|
||||
#$portent = $sitetab->getAttribs({key=>'defserialflow'},'value');
|
||||
@entries = xCAT::TableUtils->get_site_attribute("defserialflow");
|
||||
$t_entry = $entries[0];
|
||||
if ( defined($t_entry) ) {
|
||||
$serialflow=$t_entry;
|
||||
}
|
||||
#$portent = $sitetab->getAttribs({key=>'xcatdport'},'value');
|
||||
@entries = xCAT::TableUtils->get_site_attribute("xcatdport");
|
||||
$t_entry = $entries[0];
|
||||
if ( defined($t_entry) ) {
|
||||
$xcatdport=$t_entry;
|
||||
}
|
||||
#$sitetab->close;
|
||||
#}
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("defserialport");
|
||||
my $t_entry = $entries[0];
|
||||
if ( defined($t_entry) ) {
|
||||
$serialport=$t_entry;
|
||||
}
|
||||
|
||||
@entries = xCAT::TableUtils->get_site_attribute("defserialspeed");
|
||||
$t_entry = $entries[0];
|
||||
if ( defined($t_entry) ) {
|
||||
$serialspeed=$t_entry;
|
||||
}
|
||||
|
||||
@entries = xCAT::TableUtils->get_site_attribute("defserialflow");
|
||||
$t_entry = $entries[0];
|
||||
if ( defined($t_entry) ) {
|
||||
$serialflow=$t_entry;
|
||||
}
|
||||
|
||||
@entries = xCAT::TableUtils->get_site_attribute("xcatdport");
|
||||
$t_entry = $entries[0];
|
||||
if ( defined($t_entry) ) {
|
||||
$xcatdport=$t_entry;
|
||||
}
|
||||
|
||||
my $tftpdir = xCAT::TableUtils->getTftpDir();
|
||||
my $arch = $request->{arg}->[0];
|
||||
@ -55,8 +50,8 @@ sub process_request {
|
||||
$callback->({error=>"Need to specify architecture (x86, x86_64 or ppc64)"},{errorcode=>[1]});
|
||||
return;
|
||||
} elsif ( $arch eq "ppc64le" or $arch eq "ppc64el" ) {
|
||||
$callback->({data=>"The arch:$arch is not supported at present, pls use \"ppc64\" instead"});
|
||||
return;
|
||||
$callback->({data=>"The arch:$arch is not supported at present, pls use \"ppc64\" instead"});
|
||||
return;
|
||||
}
|
||||
unless (-d "$::XCATROOT/share/xcat/netboot/$arch" or -d "$::XCATROOT/share/xcat/netboot/genesis/$arch") {
|
||||
$callback->({error=>"Unable to find directory $::XCATROOT/share/xcat/netboot/$arch or $::XCATROOT/share/xcat/netboot/genesis/$arch",errorcode=>[1]});
|
||||
@ -121,8 +116,8 @@ sub process_request {
|
||||
copy("/root/.ssh/id_rsa.pub","$tempdir$sshdir/authorized_keys");
|
||||
chmod(0600,"$tempdir$sshdir/authorized_keys");
|
||||
if (not $invisibletouch and -r "/etc/xcat/hostkeys/ssh_host_rsa_key") {
|
||||
copy("/etc/xcat/hostkeys/ssh_host_rsa_key","$tempdir/etc/ssh_host_rsa_key");
|
||||
copy("/etc/xcat/hostkeys/ssh_host_dsa_key","$tempdir/etc/ssh_host_dsa_key");
|
||||
copy("/etc/xcat/hostkeys/ssh_host_rsa_key","$tempdir/etc/ssh_host_rsa_key");
|
||||
copy("/etc/xcat/hostkeys/ssh_host_dsa_key","$tempdir/etc/ssh_host_dsa_key");
|
||||
chmod(0600,<$tempdir/etc/ssh_*>);
|
||||
}
|
||||
unless ($invisibletouch or -r "$tempdir/etc/ssh_host_rsa_key") {
|
||||
@ -131,34 +126,34 @@ sub process_request {
|
||||
}
|
||||
my $lzma_exit_value=1;
|
||||
if ($invisibletouch) {
|
||||
my $done=0;
|
||||
if (-x "/usr/bin/lzma") { #let's reclaim some of that size...
|
||||
$callback->({data=>["Creating genesis.fs.$arch.lzma in $tftpdir/xcat"]});
|
||||
system("cd $tempdir; find . | cpio -o -H newc | lzma -C crc32 -9 > $tftpdir/xcat/genesis.fs.$arch.lzma");
|
||||
$lzma_exit_value=$? >> 8;
|
||||
if ($lzma_exit_value) {
|
||||
$callback->({data=>["Creating genesis.fs.$arch.lzma in $tftpdir/xcat failed, falling back to gzip"]});
|
||||
unlink ("$tftpdir/xcat/genesis.fs.$arch.lzma");
|
||||
} else {
|
||||
$done = 1;
|
||||
$initrd_file = "$tftpdir/xcat/genesis.fs.$arch.lzma";
|
||||
}
|
||||
}
|
||||
|
||||
if (not $done) {
|
||||
$callback->({data=>["Creating genesis.fs.$arch.gz in $tftpdir/xcat"]});
|
||||
system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/genesis.fs.$arch.gz");
|
||||
$initrd_file = "$tftpdir/xcat/genesis.fs.$arch.gz";
|
||||
}
|
||||
my $done=0;
|
||||
if (-x "/usr/bin/lzma") { #let's reclaim some of that size...
|
||||
$callback->({data=>["Creating genesis.fs.$arch.lzma in $tftpdir/xcat"]});
|
||||
system("cd $tempdir; find . | cpio -o -H newc | lzma -C crc32 -9 > $tftpdir/xcat/genesis.fs.$arch.lzma");
|
||||
$lzma_exit_value=$? >> 8;
|
||||
if ($lzma_exit_value) {
|
||||
$callback->({data=>["Creating genesis.fs.$arch.lzma in $tftpdir/xcat failed, falling back to gzip"]});
|
||||
unlink ("$tftpdir/xcat/genesis.fs.$arch.lzma");
|
||||
} else {
|
||||
$done = 1;
|
||||
$initrd_file = "$tftpdir/xcat/genesis.fs.$arch.lzma";
|
||||
}
|
||||
}
|
||||
|
||||
if (not $done) {
|
||||
$callback->({data=>["Creating genesis.fs.$arch.gz in $tftpdir/xcat"]});
|
||||
system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/genesis.fs.$arch.gz");
|
||||
$initrd_file = "$tftpdir/xcat/genesis.fs.$arch.gz";
|
||||
}
|
||||
} else {
|
||||
$callback->({data=>["Creating nbfs.$arch.gz in $tftpdir/xcat"]});
|
||||
system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/nbfs.$arch.gz");
|
||||
$initrd_file = "$tftpdir/xcat/nbfs.$arch.gz";
|
||||
$callback->({data=>["Creating nbfs.$arch.gz in $tftpdir/xcat"]});
|
||||
system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/nbfs.$arch.gz");
|
||||
$initrd_file = "$tftpdir/xcat/nbfs.$arch.gz";
|
||||
}
|
||||
system ("rm -rf $tempdir");
|
||||
unless ($initrd_file) {
|
||||
$callback->({data=>["Creating filesystem file in $tftpdir/xcat failed"]});
|
||||
return;
|
||||
$callback->({data=>["Creating filesystem file in $tftpdir/xcat failed"]});
|
||||
return;
|
||||
}
|
||||
|
||||
CREAT_CONF_FILE:
|
||||
@ -182,11 +177,11 @@ CREAT_CONF_FILE:
|
||||
my $normnets = xCAT::NetworkUtils->my_nets();
|
||||
my $consolecmdline;
|
||||
if (defined($serialport) and $serialspeed) {
|
||||
if ($arch =~ /ppc/) {
|
||||
$consolecmdline = "console=tty0 console=hvc$serialport,$serialspeed";
|
||||
} else {
|
||||
$consolecmdline = "console=tty0 console=ttyS$serialport,$serialspeed";
|
||||
}
|
||||
if ($arch =~ /ppc/) {
|
||||
$consolecmdline = "console=tty0 console=hvc$serialport,$serialspeed";
|
||||
} else {
|
||||
$consolecmdline = "console=tty0 console=ttyS$serialport,$serialspeed";
|
||||
}
|
||||
if ($serialflow =~ /cts/ or $serialflow =~ /hard/) {
|
||||
$consolecmdline .= "n8r";
|
||||
}
|
||||
@ -199,12 +194,12 @@ CREAT_CONF_FILE:
|
||||
mkpath("$tftpdir/pxelinux.cfg");
|
||||
chmod(0755,"$tftpdir/pxelinux.cfg");
|
||||
if (-r "/usr/lib/syslinux/pxelinux.0") {
|
||||
copy("/usr/lib/syslinux/pxelinux.0","$tftpdir/pxelinux.0");
|
||||
copy("/usr/lib/syslinux/pxelinux.0","$tftpdir/pxelinux.0");
|
||||
} elsif (-r "/usr/share/syslinux/pxelinux.0") {
|
||||
copy("/usr/share/syslinux/pxelinux.0","$tftpdir/pxelinux.0");
|
||||
copy("/usr/share/syslinux/pxelinux.0","$tftpdir/pxelinux.0");
|
||||
}
|
||||
if (-r "$tftpdir/pxelinux.0") {
|
||||
chmod(0644,"$tftpdir/pxelinux.0");
|
||||
chmod(0644,"$tftpdir/pxelinux.0");
|
||||
}
|
||||
} elsif ($arch =~ /ppc/) {
|
||||
mkpath("$tftpdir/pxelinux.cfg/p/");
|
||||
@ -215,60 +210,59 @@ CREAT_CONF_FILE:
|
||||
$net =~s/\//_/;
|
||||
$dopxe=0;
|
||||
if ($arch =~ /x86/) { #only do pxe if just x86 or x86_64 and no x86
|
||||
if ($arch =~ /x86_64/ and not $invisibletouch) {
|
||||
if (-r "$tftpdir/xcat/xnba/nets/$net") {
|
||||
my $cfg;
|
||||
my @contents;
|
||||
open($cfg,"<","$tftpdir/xcat/xnba/nets/$net");
|
||||
@contents = <$cfg>;
|
||||
close($cfg);
|
||||
if (grep (/x86_64/,@contents)) {
|
||||
$dopxe=1;
|
||||
}
|
||||
} else {
|
||||
$dopxe = 1;
|
||||
}
|
||||
} else {
|
||||
$dopxe = 1;
|
||||
}
|
||||
if ($arch =~ /x86_64/ and not $invisibletouch) {
|
||||
if (-r "$tftpdir/xcat/xnba/nets/$net") {
|
||||
my $cfg;
|
||||
my @contents;
|
||||
open($cfg,"<","$tftpdir/xcat/xnba/nets/$net");
|
||||
@contents = <$cfg>;
|
||||
close($cfg);
|
||||
if (grep (/x86_64/,@contents)) {
|
||||
$dopxe=1;
|
||||
}
|
||||
} else {
|
||||
$dopxe = 1;
|
||||
}
|
||||
} else {
|
||||
$dopxe = 1;
|
||||
}
|
||||
}
|
||||
if ($dopxe) {
|
||||
my $cfg;
|
||||
my $cfg;
|
||||
open($cfg,">","$tftpdir/xcat/xnba/nets/$net");
|
||||
print $cfg "#!gpxe\n";
|
||||
if ($invisibletouch) {
|
||||
print $cfg 'imgfetch -n kernel http://${next-server}/tftpboot/xcat/genesis.kernel.'."$arch quiet xcatd=".$normnets->{$_}.":$xcatdport $consolecmdline BOOTIF=01-".'${netX/machyp}'."\n";
|
||||
if ($lzma_exit_value) {
|
||||
print $cfg 'imgfetch -n nbfs http://${next-server}/tftpboot/xcat/genesis.fs.'."$arch.gz\n";
|
||||
} else {
|
||||
print $cfg 'imgfetch -n nbfs http://${next-server}/tftpboot/xcat/genesis.fs.'."$arch.lzma\n";
|
||||
}
|
||||
if ($invisibletouch) {
|
||||
print $cfg 'imgfetch -n kernel http://${next-server}/tftpboot/xcat/genesis.kernel.'."$arch quiet xcatd=".$normnets->{$_}.":$xcatdport $consolecmdline BOOTIF=01-".'${netX/machyp}'."\n";
|
||||
if ($lzma_exit_value) {
|
||||
print $cfg 'imgfetch -n nbfs http://${next-server}/tftpboot/xcat/genesis.fs.'."$arch.gz\n";
|
||||
} else {
|
||||
print $cfg 'imgfetch -n nbfs http://${next-server}/tftpboot/xcat/genesis.fs.'."$arch.lzma\n";
|
||||
}
|
||||
} else {
|
||||
print $cfg 'imgfetch -n kernel http://${next-server}/tftpboot/xcat/nbk.'."$arch quiet xcatd=".$normnets->{$_}.":$xcatdport $consolecmdline\n";
|
||||
print $cfg 'imgfetch -n nbfs http://${next-server}/tftpboot/xcat/nbfs.'."$arch.gz\n";
|
||||
}
|
||||
print $cfg 'imgfetch -n kernel http://${next-server}/tftpboot/xcat/nbk.'."$arch quiet xcatd=".$normnets->{$_}.":$xcatdport $consolecmdline\n";
|
||||
print $cfg 'imgfetch -n nbfs http://${next-server}/tftpboot/xcat/nbfs.'."$arch.gz\n";
|
||||
}
|
||||
print $cfg "imgload kernel\n";
|
||||
print $cfg "imgexec kernel\n";
|
||||
close($cfg);
|
||||
if ($invisibletouch and $arch =~ /x86_64/) { #UEFI time
|
||||
open($cfg,">","$tftpdir/xcat/xnba/nets/$net.elilo");
|
||||
print $cfg "default=\"xCAT Genesis (".$normnets->{$_}.")\"\n";
|
||||
print $cfg " delay=5\n";
|
||||
print $cfg ' image=/tftpboot/xcat/genesis.kernel.'."$arch\n";
|
||||
print $cfg " label=\"xCAT Genesis (".$normnets->{$_}.")\"\n";
|
||||
if ($lzma_exit_value) {
|
||||
print $cfg " initrd=/tftpboot/xcat/genesis.fs.$arch.gz\n";
|
||||
} else {
|
||||
print $cfg " initrd=/tftpboot/xcat/genesis.fs.$arch.lzma\n";
|
||||
}
|
||||
print $cfg " append=\"quiet xcatd=".$normnets->{$_}.":$xcatdport destiny=discover $consolecmdline BOOTIF=%B\"\n";
|
||||
close($cfg);
|
||||
open($cfg,">","$tftpdir/xcat/xnba/nets/$net.uefi");
|
||||
print $cfg "#!gpxe\n";
|
||||
print $cfg 'chain http://${next-server}/tftpboot/xcat/elilo-x64.efi -C /tftpboot/xcat/xnba/nets/'."$net.elilo\n";
|
||||
close($cfg);
|
||||
}
|
||||
|
||||
if ($invisibletouch and $arch =~ /x86_64/) { #UEFI time
|
||||
open($cfg,">","$tftpdir/xcat/xnba/nets/$net.elilo");
|
||||
print $cfg "default=\"xCAT Genesis (".$normnets->{$_}.")\"\n";
|
||||
print $cfg " delay=5\n";
|
||||
print $cfg ' image=/tftpboot/xcat/genesis.kernel.'."$arch\n";
|
||||
print $cfg " label=\"xCAT Genesis (".$normnets->{$_}.")\"\n";
|
||||
if ($lzma_exit_value) {
|
||||
print $cfg " initrd=/tftpboot/xcat/genesis.fs.$arch.gz\n";
|
||||
} else {
|
||||
print $cfg " initrd=/tftpboot/xcat/genesis.fs.$arch.lzma\n";
|
||||
}
|
||||
print $cfg " append=\"quiet xcatd=".$normnets->{$_}.":$xcatdport destiny=discover $consolecmdline BOOTIF=%B\"\n";
|
||||
close($cfg);
|
||||
open($cfg,">","$tftpdir/xcat/xnba/nets/$net.uefi");
|
||||
print $cfg "#!gpxe\n";
|
||||
print $cfg 'chain http://${next-server}/tftpboot/xcat/elilo-x64.efi -C /tftpboot/xcat/xnba/nets/'."$net.elilo\n";
|
||||
close($cfg);
|
||||
}
|
||||
} elsif ($arch =~ /ppc/) {
|
||||
open($cfgfile,">", "$tftpdir/pxelinux.cfg/p/$net");
|
||||
print $cfgfile "default \"xCAT Genesis (".$normnets->{$_}.")\"\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user