From b767f422353b4757fcf16dfc2581836a45278947 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 18 Mar 2008 12:50:40 +0000 Subject: [PATCH] No longer needed, the install process creates the db entries git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@799 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/sbin/init_xcatdb | 124 ------------------------------- 1 file changed, 124 deletions(-) delete mode 100644 xCAT-server-2.0/sbin/init_xcatdb diff --git a/xCAT-server-2.0/sbin/init_xcatdb b/xCAT-server-2.0/sbin/init_xcatdb deleted file mode 100644 index 32170d729..000000000 --- a/xCAT-server-2.0/sbin/init_xcatdb +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/perl -# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html -#egan@us.ibm.com -#(C)IBM Corp - -# - -BEGIN -{ - $::XCATROOT = - $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} - : -d '/opt/xcat' ? '/opt/xcat' - : '/usr'; -} -use lib "$::XCATROOT/lib/perl"; -use File::Basename; -use Getopt::Long; -use xCAT::MsgUtils; -use xCAT::Utils; - -#----------------------------------------------------------------------------- - -=head1 init_xcatdb - - This routine initializes a new database with the default values in the site - table and necessary credentials for the xcatd daemon to run. - -=cut - -#----------------------------------------------------------------------------- - -my $rc = &init_db; - -exit $rc; - -#----------------------------------------------------------------------------- - -=head3 init_db - - -=cut - -#----------------------------------------------------------------------------- -sub init_db -{ - my $rc = 0; - my @timezone = `grep ZONE= /etc/sysconfig/clock|cut -d= -f 2`; - my $hostname = `hostname`; - my $masterhost = `getent hosts $hostname`; - my ($masterip, $mastername) = split ' ', $masterhost; - my $domain = `hostname -d`; - my @cmd = ( - "chtab key=xcatdport site.value=3001", - "chtab key=master site.value=$masterip", - "chtab key=tftpdir site.value=/tftpboot", - "chtab key=domain site.value=$domain", - "chtab key=timezone site.value=$timezone[0]", - "chtab key=installdir site.value=/install", - "chtab priority=1 policy.name=root policy.rule=allow", - "chtab priority=2 policy.commands=getbmcconfig policy.rule=allow", - "chtab priority=3 policy.commands=nextdestiny policy.rule=allow", - "chtab priority=4 policy.commands=getdestiny policy.rule=allow" - ); - foreach $cmd (@cmd) { - - my @output = xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", "Error from $cmd, @output"); - } - } - - # build /etc/xcat/cfgloc - my @cfg; - my $cfg2; - my $dbinfo; - my $configfile = "/etc/sysconfig/xcat"; - if (-e ($configfile)) - { - open(CFGFILE, "<$configfile") - or xCAT::MsgUtils->message( - 'S', - "Cannot open $configfile for DB access. Please create using information in the xCAT 2.0 Cookbook ( Setting up postgresql) and rerun this script.\n" - ); - foreach my $line () - { - if (grep /XCATCFG/, $line) - { - @cfg = split /XCATCFG=/, $line; - @cfg2 = split /'/, $cfg[1]; - chomp $cfg2[1]; - $dbinfo = $cfg2[1]; - close CFGFILE; - last; - } - } - if ($dbinfo) - { - `echo "$dbinfo" > /etc/xcat/cfgloc`; - chmod 0600,"/etc/xcat/cfgloc"; - } - else - { - xCAT::MsgUtils->message("E", - "The contents of $configfile is invalid\n"); - } - } - else - { - xCAT::MsgUtils->message( - "E", - "$configfile does not exist, need to create and rerun the script\n" - ); - } - - $cmd = "service xcatd restart"; - my @output = xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", "Error from $cmd, @output"); - } - - return $rc; -}