Files
loci/scripts/install.sh
Jean-Philippe Evrard ba4d187092 Introduce extra *dep parameter
Without this patch, it is not possible to have your own
bindep or pydep file, and you must rely on what is in tree.

This is a problem for deployers that want to bring their own
bindep file, as they would need to fork the repository or
'taint it' by altering its content before building.

This patch introduces new parameters, EXTRA_BINDEP and
EXTRA_PYDEP, whose contents are path of files to be copied
into the containers. These parameters will be chained
(added on top of) the default *dep files.

In the current status Docker doesn't allow multiple files
to be passed as argument, and therefore the ability of
overrides is limited, but should be enough to allow deployers
to provide ONE file on top of existing bindep/pydeps.

Change-Id: I7e9f7954bb3c31dd8fee87c253a8768c6ec52b5c
2018-10-12 15:55:49 +00:00

94 lines
2.7 KiB
Bash
Executable File

#!/bin/bash
set -ex
distro=$(awk -F= '/^ID=/ {gsub(/\"/, "", $2); print $2}' /etc/*release)
export distro=${DISTRO:=$distro}
if [[ "${PYTHON3}" == "no" ]]; then
dpkg_python_packages=("python" "virtualenv")
rpm_python_packages=("python" "python-virtualenv")
else
dpkg_python_packages=("python3" "python3-virtualenv")
rpm_python_packages=("python3" "python3-virtualenv")
fi
case ${distro} in
debian|ubuntu)
apt-get update
apt-get upgrade -y
apt-get install -y --no-install-recommends \
git \
ca-certificates \
netbase \
lsb-release \
patch \
sudo \
${dpkg_python_packages[@]}
;;
centos)
yum upgrade -y
yum install -y --setopt=skip_missing_names_on_install=False \
git \
patch \
redhat-lsb-core \
sudo \
${rpm_python_packages[@]}
;;
opensuse|opensuse-leap|sles)
if [[ "${PYTHON3}" == "no" ]]; then
rpm_python_packages+=("python-devel" "python-setuptools")
else
rpm_python_packages+=("python3-devel" "python3-setuptools")
fi
zypper --non-interactive --gpg-auto-import-keys refresh
zypper --non-interactive install --no-recommends \
ca-certificates \
git-core \
lsb-release \
patch \
sudo \
tar \
${rpm_python_packages[@]}
#NOTE(evrardjp) Temporary workaround until bindep is fixed
# for leap 15: https://review.openstack.org/#/c/586038/
# should be merged and released.
sed -i 's/ID="opensuse-leap"/ID="opensuse"/g' /etc/os-release
;;
*)
echo "Unknown distro: ${distro}"
exit 1
;;
esac
if [[ "${PROJECT}" == "requirements" ]]; then
$(dirname $0)/requirements.sh
exit 0
fi
$(dirname $0)/fetch_wheels.sh
if [[ "${PROJECT}" == "infra" ]]; then
$(dirname $0)/setup_pip.sh
$(dirname $0)/pip_install.sh bindep ${PIP_PACKAGES}
$(dirname $0)/install_packages.sh
$(dirname $0)/cleanup.sh
exit 0
fi
if [[ "${PLUGIN}" == "no" ]]; then
$(dirname $0)/create_user.sh
$(dirname $0)/setup_pip.sh
$(dirname $0)/pip_install.sh bindep
for file in /opt/loci/pydep*; do
PYDEP_PACKAGES+=($(bindep -f $file -b -l newline ${PROJECT} ${PROFILES} ${python3} || :))
done
$(dirname $0)/pip_install.sh ${PYDEP_PACKAGES[@]}
fi
if [[ ${PROJECT} == 'nova' ]]; then
$(dirname $0)/install_nova_console.sh
fi
$(dirname $0)/clone_project.sh
$(dirname $0)/install_packages.sh
$(dirname $0)/pip_install.sh /tmp/${PROJECT} ${PIP_PACKAGES}
$(dirname $0)/cleanup.sh