| #!/bin/bash |
| |
| # @@@ START COPYRIGHT @@@ |
| # |
| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| # |
| # @@@ END COPYRIGHT @@@ |
| |
| |
| #============================================== |
| |
| timestamp=$(date +%F-%H-%M-%S) |
| export TRAF_CONFIG="/etc/trafodion/trafodion_config" |
| source $TRAF_CONFIG |
| |
| while [[ $# -gt 0 ]]; do |
| case "$1" in |
| --nodes) |
| MY_NEW_NODES="" |
| NEW_NODES="$2" |
| |
| for node in $NEW_NODES |
| do |
| MY_NEW_NODES="$MY_NEW_NODES -w $node" |
| done |
| |
| export PDSH_SSH_CMD="ssh -q -n %h" |
| |
| export TRAF_NEW_PDSH="pdsh -R exec $MY_NEW_NODES $PDSH_SSH_CMD" |
| export TRAF_NEW_PDCP="pdcp -R ssh $MY_NEW_NODES" |
| shift |
| ;; |
| *) |
| echo "***ERROR: unknown parameter '$1'" |
| print_usage |
| exit -1 |
| esac |
| shift |
| done |
| |
| #======================================== |
| echo "***INFO: Installing required packages" |
| echo "***INFO: Log file location $PWD" |
| |
| YUM_LOG=$PWD/trafodion_yum_$timestamp.log |
| |
| #=============================== |
| |
| $TRAF_NEW_PDSH sudo yum --assumeyes install epel-release >> $YUM_LOG |
| $TRAF_NEW_PDSH sudo yum --assumeyes install pdsh >> $YUM_LOG |
| |
| if [ $? != 0 ]; then |
| echo "***ERROR: Can't install pdsh on $NEW_NODES" |
| exit -1 |
| fi |
| |
| package_list="apr apr-util sqlite expect perl-DBD-SQLite* protobuf xerces-c perl-Params-Validate perl-Time-HiRes gzip lzo lzop unzip unixODBC libiodbc libiodbc-devel openldap-clients snappy lsof gnuplot" |
| |
| for package in $package_list |
| do |
| echo "***INFO: Checking if $package is installed ..." |
| for node in $NEW_NODES |
| do |
| installed=`ssh -q -n $node sudo rpm -qa | grep $package | wc -l` |
| if [[ $installed -eq "0" ]]; then |
| echo "***INFO: Installing $package on all nodes" |
| ssh -q -n $node sudo yum --assumeyes install $package 2>> $YUM_LOG >> $YUM_LOG |
| if [ $? != 0 ]; then |
| echo "***ERROR: Can't install $package" |
| exit -1 |
| fi |
| fi |
| done |
| done |