From 3dcaa57795e3041189d5b92da41c3621db8fc6a4 Mon Sep 17 00:00:00 2001 From: sjing Date: Mon, 21 Feb 2011 02:19:12 +0000 Subject: [PATCH] Add INUCLIENTS support for AIX. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8895 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/xcatconfig | 60 +++++++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 9fef2d85b..7887ae96c 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -129,6 +129,40 @@ else { $::osname = 'Linux'; } + +# +# To support AIX INUCLIENTS +# +if (($::osname eq 'AIX') && ($ENV{'INUCLIENTS'} == 1)) +{ + # INUCLIENTS is configured, add xcatconfig to /etc/inittab + my $cmd = "/usr/sbin/lsitab xcatconfig > /dev/null 2>&1"; + my $rc = system("$cmd") >>8; + if ($rc != 0) + { + # add new entry + my $flag; + if ($::INITIALINSTALL) + { + $flag = "-i"; + } + + if ($::UPDATEINSTALL) + { + $flag = "-u"; + } + + if ($::initDB) + { + $flag = "-d"; + } + + my $mkcmd = qq~/usr/sbin/mkitab "xcatconfig:2:once:$::XCATROOT/sbin/xcatconfig $flag > /dev/console 2>&1"~; + system("$mkcmd"); + } + exit(0); +} + if ($::osname eq 'AIX') { $::arch = `uname -p`; @@ -321,15 +355,7 @@ if ($::INITIALINSTALL || $::FORCE || $::UPDATEINSTALL || $::genCredentials) my $xcmd; if ($::osname eq 'AIX') { - if ($ENV{'INUCLIENTS'} == 1) - { - #Do nothing in not running system - - } - else - { - $xcmd = "$::XCATROOT/sbin/restartxcatd"; - } + $xcmd = "$::XCATROOT/sbin/restartxcatd"; } else { @@ -370,6 +396,22 @@ if (($::osname eq 'Linux') && (($::INITIALINSTALL || $::FORCE))) } #End - more - Linux-only config +END +{ + # Remove xcatconfig itself from the inittab + + if (($::osname eq 'AIX') && ($ENV{'INUCLIENTS'} != 1)) + { + my $cmd = "/usr/sbin/lsitab xcatconfig > /dev/null 2>&1"; + my $rc = system("$cmd") >>8; + if ($rc == 0) + { + my $rmcmd = '/usr/sbin/rmitab xcatconfig'; + system("$rmcmd"); + } + } +} + exit; #####################################