# OCMcfg.def: Assists Oracle Configuration Manager Interface Setup # $Id: OCMcfg.def,v 1.15 2012/01/03 13:34:42 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/OCMcfg.def,v 1.15 2012/01/03 13:34:42 mschenke Exp $ # # Change History # 20120103 MSC Change the copyright notice. =head1 NAME OCMcfg - Assists Oracle Configuration Manager Interface Setup =head1 DESCRIPTION This module provided associated logic for the setup of the Oracle Configuration Manager interface setup. =cut #------------------------------------------------------------------------------ # Section init: Module initialization #------------------------------------------------------------------------------ section init var $configCCR = ${AS.EXE:'configCCR'} var $emCCR = ${AS.BATCH:'emCCR'} keep $configCCR,$emCCR,@sta,%cfg #------------------------------------------------------------------------------ # Section analyze: Analyze the context #------------------------------------------------------------------------------ section analyze # Initialisation var (@sta,@ids,%cfg) = () # Define the check macros macro chk_config {var (\@tbl,\$flg,$hom,$ctl,\%cfg) = @arg import $configCCR keep $cnt,$configCCR if !grepDir(catDir($hom,'ccr'),'^\.+$','v') {# Get the associate Oracle home var $ora = undef if match($ctl,'\.bat',true) {if grepFile($ctl,'^\s*set\s+\ORACLE_HOME\s*=','fi') var $ora = catDir(value(last)) } else {if grepFile($ctl,'^\s*\$OracleHome\s*=','f') var (undef,$ora) = match(value(last),'([\042\047])(.*?)\1') } # Check configuration feasability if !?$ora return 'Skipped (OH not found)' if missing($cfg{$ora}) {if !testFile('f',catFile($ora,'ccr','bin',$configCCR)) return $cfg{$ora} = 'Skipped (Other OH)' var $cfg{$ora} = '' } elsif $cfg{$ora} return last # Report pending configuration var $flg = false call push(@tbl,$uid = concat('ID',incr($cnt))) call setTempSetting(concat('OCM_CONFIG_DIR_',$uid),$hom) return 'Configuration pending' } if grepFile(catFile($hom,'ccr','config','emCCRenv'),\ '^\s*ORACLE_CONFIG_HOME\s*=') {call setTempSetting('can_use',1) return 'Configured' } return 'Unknown status' } macro chk_setup {var (\$flg,\$cfg,$key,$ccr) = @arg import $configCCR,$emCCR keep $configCCR,$emCCR # Check if installed if testFile('f',catFile($ccr,'bin',$configCCR)) var $cfg = '' if testFile('f',catFile($ccr,'bin',$emCCR)) {call setTempSetting('can_use',1) if testDir('d',catDir($ccr,'hosts')) {if or(testDir('d',catDir($ccr,'hosts',${RDA.HOST})),\ testDir('d',catDir($ccr,'hosts',${RDA.NODE}))) {call setTempSetting('can_use',1) return 'Configured' } } return 'Installed' } # Check if setup pending if testFile('f',catFile($ccr,'bin',${AS.EXE:'setupCCR'})) {if grepDir(catDir($ccr,'inventory','pending'),'\.jar$','i') {var ($cfg,$flg) = ('',false) call setTempSetting($key,'C|C|D|D|N|N') return 'Setup pending' } } # Indicate an unknows status return 'Unknown status' } # Analyze the Oracle home var $flg = true var $dir = ${ORACLE_HOME:''} var $par = ${ORACLE_PARENT:catDir(${ORACLE_HOME:''},upDir())} var $com = catDir($par,'oracle_common') var $utl = catDir($par,'utils') var $key = 'Oracle home' if !length($dir) call push(@sta,[$key,'Not specified']) elsif !testDir('d',$dir = catDir($dir)) call push(@sta,[$key,'Not yet existing']) elsif sameDir($dir,$com) call push(@sta,[$key,'Skipped (See oracle_common)']) elsif sameDir($dir,$utl) call push(@sta,[$key,'Skipped (See utils)']) elsif or(testDir('d',catDir($dir,'ccr')),\ testDir('d',catDir($dir,'livelink'))) {var $cfg = 'Skipped (OCM issue)' call push(@sta,[$key,chk_setup(\$flg,\$cfg,'OCM_SETUP_RSP_OH',lastDir())]) var $cfg{$dir} = $cfg call setTempSetting('OCM_SETUP_DIR_OH',$dir) } else var $cfg{$dir} = 'Skipped (No OCM)' # Analyze the Middleware home var $key = 'Middleware utils' if and(testDir('d',$com),testDir('d',catDir($com,'ccr'))) {# Analyze the Middleware oracle_common directory var $cfg = 'Skipped (OCM issue)' call push(@sta,[$key,chk_setup(\$flg,\$cfg,'OCM_SETUP_RSP_MW',lastDir())]) var $cfg{$com} = $cfg call setTempSetting('OCM_SETUP_DIR_MW',$com) } elsif and(testDir('d',$utl),testDir('d',catDir($utl,'ccr'))) {# Analyze the Middleware utils directory var $cfg = 'Skipped (OCM issue)' call push(@sta,[$key,chk_setup(\$flg,\$cfg,'OCM_SETUP_RSP_MW',lastDir())]) var $cfg{$utl} = $cfg call setTempSetting('OCM_SETUP_DIR_MW',$utl) } elsif testDir('d',$utl) {call push(@sta,[$key,'OCM not present']) var $cfg{$utl} = 'Skipped (No OCM)' } elsif testDir('d',$com) {call push(@sta,[$key,'OCM not present']) var $cfg{$com} = 'Skipped (No OCM)' } else {call push(@sta,[$key,'Not found']) var $cfg{$utl} = 'Skipped (No utils)' } # Retrieve instances var %ins = () if testDir('d',$dir = ${INSTANCE_ROOT}) {loop $hom (grepDir($dir,'^[^\.]','p')) {if or(testFile('f',catFile($hom,'bin','opmnctl')),\ testFile('f',catFile($hom,'bin','opmnctl.bat')),\ testFile('f',catFile($hom,'bin','opmnctl.exe'))) var $ins{$hom} = lastFile() } } if testDir('d',$dir = ${ORACLE_PARENT}) {loop $hit (grepDir($dir,'^bin$','ir',2)) {next !testDir('d',$hit) var @dir = splitDir($hit) call pop(@dir) var $sub = pop(@dir) next or(testDir('d',catDir(@dir,'inventory')),\ testDir('d',catDir(@dir,'jdk')),\ testDir('d',catDir(@dir,'oui'))) var $hom = catDir(@dir,$sub) if or(testFile('f',catFile($hom,'bin','opmnctl')),\ testFile('f',catFile($hom,'bin','opmnctl.bat')),\ testFile('f',catFile($hom,'bin','opmnctl.exe'))) var $ins{$hom} = lastFile() } } # Analyze the instances if keys(%ins) {loop $ins (last) call push(@sta,[concat('Instance ',$ins),\ chk_config(\@ids,\$flg,$ins,$ins{$ins},\%cfg)]) call setTempSetting('OCM_INSTANCES_RSP',"1|A|2|S|3|N") } if @ids call setTempSetting('OCM_INSTANCE_IDS',join('|',@ids)) var ${AUX.dft} = $flg #------------------------------------------------------------------------------ # Section get_overview: Produce the OCM installation overview #------------------------------------------------------------------------------ section get_overview var ($max,@txt) = (0,'OCM Installation Overview:') loop $rec (@sta) var $max = max($max,length($rec->[0])) incr $max,2 loop $rec (@sta) call push(@txt,concat(' ',$rec->[0],':',\ repeat('\040',expr('-',$max,length($rec->[0]))),\ $rec->[1])) call push(@txt,"","Please hit 'Return' to continue") var ${AUX.inp} = join('\n',${AUX.inp},@txt) =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut