Getinput KSH
Getinput KSH
/bin/bash
i=0
ch=0
x=0
ac=0
fg=0
rm file*
rm /home/kushal/tmp/envs/*.env
rm .sandbox.pset
cp .sandbox.pset_temp .sandbox.pset
rm /home/kushal/abinitio-AppHub-V3.2.6.15/config/apphubrc
rm /home/kushal/abinitio_config/*
rm /home/kushal/abinitio-V3.2.6.15/config/abinitiorc
##################################################
emchk=0
rcfile () {
rcpth=${pth}/config
echo "ORC path >> ${rcpth}"
echo "b>> ${b}"
if [[ ${b} = 'AppHub' ]];then
if [[ $(find "${rcpth}/apphubrc" | wc -l) = '0' ]] ;then
echo "Apphurc loop"
rcfnm=$(ls -tr ${rcpth}/apphubrc.example |rev|cut -d "/" -f1 |cut -d "." -f2|rev)
echo " Created ${rcfnm} in path ${rcpth}"
touch ${rcpth}/${rcfnm}
cat /home/kushal/tmp/apphubrc_temp >> ${rcpth}/${rcfnm} #change
sed -i "s|vr|${v}|g" ${rcpth}/${rcfnm}
aprcpth=$rcpth
else
echo "Apphubrc is present"
fi
else
#elif [[ $(ls -ltr ${rcpth} | grep -i ${a}rc | wc -l = '0') ]];then
if [[ $( find ${rcpth}/abinitiorc | wc -l) = '0' ]] 2>'/dev/null';then
fi
#clear
else
echo "creating abinitiorc 3"
echo "Shared.abinitio is present"
rcfnm=$(ls -tr "${rcpth}/abinitiorc.example" |rev|cut -d "/" -f1| cut -d "." -
f2|rev)
echo " Created ${rcfnm} in path ${rcpth}"
touch "${rcpth}/${rcfnm}"
echo "# system-wide config var settings
@include /opt/abinitio_config/shared.abinitiorc" >> ${rcpth}/${rcfnm}
fi
fi }
stenv () {
printf "################Enter the MFS partition value you need to create for this
Server >> "
mfs=$( cat file2 | grep -F MFS | cut -d "=" -f2 )
echo "checking for mfs >> $mfs"
sed -i "12 s|Line12|"$mfs"|" $(pwd)/.sandbox.pset
(find ${stpth}) 2>'/dev/null'
if [[ $? = '1' ]];then
printf "\n"
tmpstpth=$( echo ${stpth} | rev | cut -d "/" -f2- | rev )
echo " $tmpstpth is not present ,Creating it" #mkdir -p ${stpth}
printf "\n"
fi
exprt() {
if [[ $(cat ${Epath}/${Fenv} | grep -w "Line1" | wc -l) = '1' ]] ; then
sed -i "s|\<Line1\>|$pth|" ${Epath}/${Fenv}
sed -i "s/\<Line2\>/Line1/" ${Epath}/${Fenv}
sed -i "s|\<Line1\>|$pth|" $(pwd)/.sandbox.pset
sed -i "s|\<Line2\>|Line1|" $(pwd)/.sandbox.pset
else
#echo "########################Follwing Env Variable(s) of ${a} are needed for to
be customized ,Enter the LINE NUMBER and VARIABLE Value when
Prompted############################# :"
stenv
fi
else
sed -i "s|Line$ln|"$vl"|" $(pwd)/.sandbox.pset
fi
fi
done <${Epath}/${Fenv}
echo " "
fi
env (){
echo "testing version for abinitio >>$tpth : $a : $b "
cline=$(cat -s $tpth | sed -n /Line/p | wc -l )
#echo "Count $cline"
if [[ ${a} = 'abinitioCoOp' ]];then
((ac++))
if [[ ${ac} = '2' ]];then
while [[ ${cline} -gt '0' ]];
do
exprt
((--cline))
done
fi
elif [[ ${a} = 'oraClient' ]];then
exprt
fi
}
create() {
echo "Epath >> $Epath"
touch ${Epath}/${Fenv}
chmod 777 ${Epath}/${Fenv}
(cat ${cpth}/${tmpf}) >> ${Epath}/${Fenv}
echo " ${Fenv} file is created in $Epath"
install () {
ex=$(echo ${item} | rev|cut -d "/" -f1 |rev)
expath=$(echo ${item} | rev|cut -d "/" -f2- |rev)
echo " Exceutable name ${ex}; Executable path ${expath}"
echo " Installing ${a} software in ${pth}"
if [[ ${a} = 'MSTGenericClient' ]] || [[ ${a} = 'RSCD89_CTO' ]] || [[ ${a} =
'abinitioBRDServices' ]] ;then
#continue
#echo $?
for f in 1;do
break
done
else
cpth=$(pwd)
cd ${cpth}
tmpf=$(ls -tr | grep -i ${a})
#echo ${tmpf}
file=$(echo ${tmpf} | rev | cut -d ":" -f1 | rev)
Fenv=$(echo ${file} | sed -e "s/temp/$v/g")
echo "Env file will be named as ${Fenv}"
echo "flg: ${fg},Version:${v},Abinitio version:${AbV}"
if [[ ${fg} = '1' ]] && [[ ${v} = ${AbV} ]];then
Epath="${Abpth}"
exprt
for f in 1
do
continue
done
else
echo "**************************************************************
checking for path
*******************************" #path needs to be changed
Epath=$(cat file2 | grep -F Epath | cut -d "=" -f2) 2>'/dev/null'
fi
if [[ ${Epath} = 'y' ]];then
Epath="/home/kushal/tmp/envs"
if [[ $(echo ${Fenv} | cut -d "-" -f1) = 'ste' ]] && [[ ${fg} = '0' ]];then
$((fg++))
AbV=${v}
Abpth="${Epath}"
stAb=${Fenv}
fi
if [[ $(find ${Epath}/${Fenv} | wc -l ) = '1' ]] 2>'/dev/null' ;then
for f in 1
do
continue
done
else
create
fi
else
if [[ $(find ${Epath}/${Fenv} | wc -l) = '1' ]] 2>'/dev/null';then
for f in 1
do
continue
done
else
create
fi
fi
exprt
fi
tpth=${Epath}/${Fenv}
env
###################################################
echo "***************************************************"
sleep 3
fi
done < file1