stackube/tools/install-distro-packages.sh
Pengfei Ni 28ee83e1ea Add initial makefile and tools
This is for aligning with Golang CTI proposed proposed in
https://review.openstack.org/410355.

Change-Id: I04c25e8bde1bcb6c17b12284b67eb3e9953d94fe
Signed-off-by: Pengfei Ni <feiskyer@gmail.com>
2017-05-19 09:22:32 +08:00

41 lines
1.0 KiB
Bash
Executable File

#!/bin/bash -xe
# Local version to install bindep packages
# Suitable for use for development
function is_fedora {
[ -f /usr/bin/yum ] && cat /etc/*release | grep -q -e "Fedora"
}
PACKAGES=""
if ! which virtualenv; then
PACKAGES="$PACKAGES virtualenv"
fi
if ! which make; then
PACKAGES="$PACKAGES make"
fi
if [[ -n $PACKAGES ]]; then
sudo apt-get -q --assume-yes install virtualenv
fi
# Check for bindep
if ! which bindep; then
make bindep
fi
PACKAGES=$(make bindep || true)
# inspired from project-config install-distro-packages.sh
if apt-get -v >/dev/null 2>&1 ; then
sudo apt-get -qq update
sudo PATH=/usr/sbin:/sbin:$PATH DEBIAN_FRONTEND=noninteractive \
apt-get -q --option "Dpkg::Options::=--force-confold" \
--assume-yes install $PACKAGES
elif emerge --version >/dev/null 2>&1 ; then
sudo emerge -uDNq --jobs=4 @world
sudo PATH=/usr/sbin:/sbin:$PATH emerge -q --jobs=4 $PACKAGES
else
is_fedora && YUM=dnf || YUM=yum
sudo PATH=/usr/sbin:/sbin:$PATH $YUM install -y $PACKAGES
fi