From 5653e63504ddbe32a085b77c4426c28b2631c696 Mon Sep 17 00:00:00 2001 From: andywray Date: Mon, 14 Jan 2008 16:58:23 +0000 Subject: [PATCH] Set XCATROOT to default to /usr if no evironment variable and /opt/xcat does not exist git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@258 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/Client.pm | 2 +- perl-xCAT-2.0/xCAT/DSHCLI.pm | 4 +++- perl-xCAT-2.0/xCAT/NotifHandler.pm | 2 +- perl-xCAT-2.0/xCAT/Table.pm | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/perl-xCAT-2.0/xCAT/Client.pm b/perl-xCAT-2.0/xCAT/Client.pm index 6949797b5..103b87f52 100644 --- a/perl-xCAT-2.0/xCAT/Client.pm +++ b/perl-xCAT-2.0/xCAT/Client.pm @@ -3,7 +3,7 @@ package xCAT::Client; 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 xCAT::NodeRange; diff --git a/perl-xCAT-2.0/xCAT/DSHCLI.pm b/perl-xCAT-2.0/xCAT/DSHCLI.pm index 472b6d674..4d89762e5 100644 --- a/perl-xCAT-2.0/xCAT/DSHCLI.pm +++ b/perl-xCAT-2.0/xCAT/DSHCLI.pm @@ -3602,8 +3602,10 @@ sub parse_and_run_dsh if ($ENV{'XCATROOT'}) { $::XCATROOT = $ENV{'XCATROOT'}; # setup xcatroot home directory - } else { + } elsif (-d '/opt/xcat') { $::XCATROOT = "/opt/xcat"; + } else { + $::XCATROOT = "/usr"; } # parse the arguments diff --git a/perl-xCAT-2.0/xCAT/NotifHandler.pm b/perl-xCAT-2.0/xCAT/NotifHandler.pm index b31c8347f..445e7f0d4 100644 --- a/perl-xCAT-2.0/xCAT/NotifHandler.pm +++ b/perl-xCAT-2.0/xCAT/NotifHandler.pm @@ -3,7 +3,7 @@ package xCAT::NotifHandler; BEGIN { - $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } use lib "$::XCATROOT/lib/perl"; diff --git a/perl-xCAT-2.0/xCAT/Table.pm b/perl-xCAT-2.0/xCAT/Table.pm index 053ddd5ea..679bb668e 100644 --- a/perl-xCAT-2.0/xCAT/Table.pm +++ b/perl-xCAT-2.0/xCAT/Table.pm @@ -9,7 +9,7 @@ package xCAT::Table; BEGIN { - $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } use lib "$::XCATROOT/lib/perl";