fuel-plugin-mellanox/pre_build_hook
Aviram Bar-Haim 650ee39193 Fix IPOIBD to support new Fuel OVS-LB arch
In order to support arch of LB -> OVS -> LB, few changes
required to the EIPOIBD.
This commits adds these changes to a tmp ipoibd file
(until it will be patched to MLNX_OFED package).

Change-Id: I1b4f641b5227708a2d4128e112cd55fc8e149ea8
2015-05-03 19:33:35 +03:00

87 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
# Copyright 2015 Mellanox Technologies, Ltd
#
# Licensed 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.
readonly PLUGIN_DIR="$(dirname $0)"
readonly DEFAULT_REPOSITORY_HOST="10.212.14.8" #TODO: Change to MLNX public repo
if [ -z "$REPOSITORY_HOST" ]; then
REPOSITORY_HOST=$DEFAULT_REPOSITORY_HOST
fi
function download {
FILE_TYPE=$1
FILE_NAME=$2
case ${FILE_TYPE} in
'bootstrap')
PREFIX_URL=mellanox_plugin/bootstrap
BUILD_DIR=bootstrap
;;
'rpm')
PREFIX_URL=mellanox_plugin/repositories/centos/Packages
BUILD_DIR=repositories/centos/Packages
;;
'deb')
PREFIX_URL=mellanox_plugin/repositories/ubuntu
BUILD_DIR=repositories/ubuntu
;;
*)
echo "Can't download ${FILE_NAME}. File of type ${FILE_TYPE} is not supported."
exit 1
esac
URL="http://${REPOSITORY_HOST}/${PREFIX_URL}/${FILE_NAME}"
DEST_DIR="${PLUGIN_DIR}/${BUILD_DIR}"
wget ${URL} -P ${DEST_DIR}
if [ $? -ne 0 ]; then
echo "Failed fetching package from: ${URL} to ${DEST_DIR}" >&2
exit 1
fi
}
function get_packages() {
file_type=$1
old_packages=$2
files=$3
rm -rf $old_packages
for f in $files; do
download $file_type $f
done
}
old_rpms="${PLUGIN_DIR}/repositories/centos/Packages/*.rpm"
rpm_files="cirros-testvm-mellanox-0.3.2-1.mira3.x86_64.rpm
cirros-testvm-mellanox-ib-0.3.2-4.el6.x86_64.rpm
eswitchd-0.11-5.el6.x86_64.rpm
mlnx-dnsmasq-2014.2.2-1.noarch.rpm
mlnx-ofed-fuel-2.3-2.0.6.el6.x86_64.rpm
redhat-rpm-config-9.0.3-42.el6.centos.noarch.rpm"
get_packages "rpm" "$old_rpms" "$rpm_files"
old_debs="${PLUGIN_DIR}/repositories/ubuntu/*.deb"
deb_files="cirros-testvm-mellanox_0.3.2-ubuntu3_amd64.deb
cirros-testvm-mellanox-ib_0.3.2-4_amd64.deb
eswitchd_0.11-5_amd64.deb
mlnx-dnsmasq_2014.2.2-1_all.deb
mlnx-ofed-fuel_2.3-2.0.6_amd64.deb"
get_packages "deb" "$old_debs" "$deb_files"
bootstrap_dir="${PLUGIN_DIR}/bootstrap/"
bootstrap_files="initramfs.img
linux
.ofed
.kernel"
get_packages "bootstrap" "$bootstrap_dir" "$bootstrap_files"