From 934084df40df0e29a5bc4c7fa6e4ed6e22f4fb9e Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 21 Aug 2012 06:17:07 +0000 Subject: [PATCH] fix for bug 3560143: setup postgresql during xcat installation git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13567 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/xcatconfig | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 22a8481e9..aa4fec5a8 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -134,6 +134,28 @@ else } # +# If the XCATPGPW environment variable is specified, +# call pgsqlsetup command with -N flag to setup PostgreSQL database. +# This is a requirement of PCM, it should be done only in install scenario but not update. +# +if ($::INITIALINSTALL || $::FORCE) +{ + if (($::osname eq 'Linux') && $ENV{'XCATPGPW'}) + { + my $cmd = "XCATPGPW=$ENV{'XCATPGPW'} $::XCATROOT/bin/pgsqlsetup -i -N"; + my $outref = xCAT::Utils->runcmd("$cmd", 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message('E', "Could not setup PostgreSQL, falling back to sqlite..."); + $cmd = "rm -f /etc/xcat/cfgloc"; + $outref = xCAT::Utils->runcmd("$cmd", -1); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message('E', "Could not fall back to sqlite, where should we go?"); + } + } + } +} # To support AIX INUCLIENTS, to support the scenario where the user needs to install xCAT rpms # into the INUCLIENT=1 environment, such as AIX diskless node(installing xCAT in AIX NIM SPOT), # or alternative disk installation.