mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-19 04:40:21 +00:00
-Remove deprecated setnetboot.awk script
-Continue work towards restored wcons functionality -Correct mistake in previous commit with regards to XCATROOT detection git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@422 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr';
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use IO::Socket::SSL;
|
||||
|
@ -3,6 +3,7 @@
|
||||
use Getopt::Long qw(:config getopt_compat);
|
||||
use File::Basename;
|
||||
use Data::Dumper;
|
||||
use strict;
|
||||
unless ($ENV{DISPLAY}) {
|
||||
print '$DISPLAY not set';
|
||||
exit 1;
|
||||
@ -19,16 +20,81 @@ GetOptions(
|
||||
my $nodes=`nodels $ARGV[0]`;
|
||||
my @nodes = split /\n/,$nodes;
|
||||
my $firstnode = shift @nodes;
|
||||
my $currx;
|
||||
my $curry;
|
||||
my $wmxo;
|
||||
my $wmyo;
|
||||
my $currx;
|
||||
my $curry;
|
||||
my $screenwidth;
|
||||
my $screenheight;
|
||||
my $window_width;
|
||||
my $window_height;
|
||||
if (defined($tilefact)) {
|
||||
system("xterm -name $firstnode -title $firstnode -n $firstnode -geometry +0+0 -e $mydir/rcons $firstnode &");
|
||||
sleep(1);
|
||||
my $xinfo = `xwininfo -name $firstnode`
|
||||
my $rootinf = `xwininfo -root`;
|
||||
foreach (split /\n/,$rootinf) {
|
||||
if (/.*Width:\s+([0-9]*).*/) {
|
||||
$screenwidth=$1;
|
||||
} elsif (/.*Height:\s+([0-9]*).*/) {
|
||||
$screenheight=$1;
|
||||
}
|
||||
}
|
||||
system("xterm -name $firstnode -title $firstnode -n $firstnode -geometry +0+0 -e /bin/sh -c \"$mydir/xtcd.pl ".$ENV{DISPLAY}." $firstnode $firstnode & $mydir/rcons $firstnode\" &");
|
||||
sleep(2); #Give time for window manager to figure out everything
|
||||
my $xinfo = `xwininfo -name $firstnode`;
|
||||
my @xinfl = split(/\n/,$xinfo);
|
||||
my $side_pad;
|
||||
my $top_pad;
|
||||
my $wmxo;
|
||||
my $wmyo;
|
||||
foreach (@xinfl) {
|
||||
if (/.*Absolute upper-left X:\s*([0-9]*).*/) {
|
||||
$side_pad = $1;
|
||||
} elsif (/.*Absolute upper-left Y:\s*([0-9]*).*/) {
|
||||
$top_pad = $1;
|
||||
} elsif (/.*Width:\s*([0-9]*).*/) {
|
||||
$window_width = $1;
|
||||
} elsif (/.*Height:\s*([0-9]*).*/) {
|
||||
$window_height = $1;
|
||||
} elsif (/.*-gemotery \d+x\d+\+(\d+)(\d+)/) {
|
||||
$wmxo=$1;
|
||||
$wmyo=$2;
|
||||
}
|
||||
}
|
||||
$window_width += $side_pad*2; #add the side border, assuming symmetric left and right borders
|
||||
$window_height += $side_pad+$top_pad; #Add the titlebar and bottom border, which is guessed to probably be equal to the sides, doesn't hold true in all cases, i.e. window maker, but it's the currently best approximation
|
||||
$screenwidth-=$wmxo; #Subtract a factor that 1.3 did, not sure why precisely
|
||||
$screenheight-=$wmyo;
|
||||
$currx=$window_width;
|
||||
$curry=0;
|
||||
my $maxcol = int($screenwidth/$window_width);
|
||||
unless ($tilefact or $tilefact > $maxcol) {
|
||||
$tilefact=$maxcol;
|
||||
}
|
||||
if ($tilefact==1) {
|
||||
$curry+=$window_height;
|
||||
}
|
||||
} else {
|
||||
system("xterm -name $firstnode -title $firstnode -n $firstnode -e $mydir/rcons $firstnode &");
|
||||
system("xterm -name $firstnode -title $firstnode -n $firstnode -e /bin/sh -c \"$mydir/xtcd.pl ".$ENV{DISPLAY}." $firstnode $firstnode & $mydir/rcons $firstnode\" &");
|
||||
|
||||
}
|
||||
my $geometry="";
|
||||
foreach (@nodes) {
|
||||
system("xterm -name $_ -title $_ -n $_ -e $mydir/rcons $_ &");
|
||||
if ($tilefact) {
|
||||
my $corrected_x=$currx+$wmxo;
|
||||
my $corrected_y=$curry+$wmyo;
|
||||
$geometry="-geometry +$corrected_x+$corrected_y";
|
||||
$currx+=$window_width;
|
||||
if ($currx >= ($tilefact * $window_width)) {
|
||||
$currx=0;
|
||||
$curry+=$window_height;
|
||||
if ($curry > $screenheight) {
|
||||
$curry = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
system("xterm -name $_ -title $_ -n $_ $geometry -e /bin/sh -c \"$mydir/xtcd.pl .".$ENV{DISPLAY}." $_ $_ & $mydir/rcons $_\" &");
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
#!/usr/bin/awk -f
|
||||
BEGIN {
|
||||
xcatdhost = ARGV[1]
|
||||
xcatdport = ARGV[2]
|
||||
kernel = ARGV[3]
|
||||
initrd = ARGV[4]
|
||||
kcmd = ARGV[5]
|
||||
ns = "/inet/tcp/0/" ARGV[1] "/" xcatdport
|
||||
|
||||
while(1) {
|
||||
if((ns |& getline) > 0)
|
||||
print $0 | "logger -t xcat"
|
||||
|
||||
if($0 == "ready")
|
||||
print "setnetboot "kernel" "initrd" "kcmd |& ns
|
||||
if($0 == "done")
|
||||
break
|
||||
}
|
||||
close(ns)
|
||||
exit 0
|
||||
}
|
Reference in New Issue
Block a user