1
0
mirror of https://github.com/bigchaindb/bigchaindb.git synced 2024-06-16 17:43:21 +02:00
bigchaindb/pkg/scripts/bootstrap_helper.sh
muawiakh f2e1b4ac80 Automation for single node deployment for quickstart
- Change consists of two deployment models:
  - Using Vagrant(single node, with/without docker)
  - Using Ansible(single node, with/without docker)
- Updated quickstart documentation.
- Some WIP comments, which will be addressed later. Depending on the
  requirements.
2017-09-14 14:00:13 +02:00

89 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
. ./bootstrap_constants.sh
validate_os_version_and_deps(){
if $1; then
case $2 in
ubuntu)
apt-get install bc -y > /dev/null 2>&1
if [[ ($(echo $3 | bc) > $MINIMUM_UBUNTU_VERSION)
|| ($(echo $3 | bc) == $MINIMUM_UBUNTU_VERSION)]]; then
dpkg -s "${OS_DEPENDENCIES[@]}" > /dev/null 2>&1
echo $?
else
echo "Supported $2 Versions: >= $MINIMUM_UBUNTU_VERSION"
exit 1
fi
;;
centos)
yum install bc -y > /dev/null 2>&1
if [[ ($(echo $3 | bc) > $MINIMUM_CENTOS_VERSION)
|| ($(echo $3 | bc) == $MINIMUM_CENTOS_VERSION) ]]; then
rpm -q "${OS_DEPENDENCIES[@]}" > /dev/null 2>&1
echo $?
else
echo "Supported $2 Versions: >= $MINIMUM_CENTOS_VERSION"
exit 1
fi
;;
fedora)
dnf install bc -y > /dev/null 2>&1
if [[ ($(echo $3 | bc) > $MINIMUM_FEDORA_VERSION)
|| ($(echo $3 | bc) == $MINIMUM_FEDORA_VERSION) ]]; then
rpm -q "${OS_DEPENDENCIES[@]}" > /dev/null 2>&1
echo $?
else
echo "Supported $2 Versions: >= $MINIMUM_FEDORA_VERSION"
exit 1
fi
;;
*)
echo "Supported OS(s) are: [ ${SUPPORTED_OS[*]} ]."
exit 1
;;
esac
else
echo "Supported OS(s) are: [ ${SUPPORTED_OS[*]} ]."
exit 1
fi
}
install_dependencies() {
case $1 in
ubuntu)
install_deps_deb
;;
centos)
install_deps_centos
;;
fedora)
install_deps_fedora
;;
*)
echo "Supported OS(s) are: [ ${SUPPORTED_OS[*]} ]."
exit 1
;;
esac
}
#TODO: muawiakh(Currently only ansible is required. Make it generic for
# multiple dependencies)
install_deps_deb() {
echo "Installing Dependencies..."
apt-get install -y software-properties-common
apt-add-repository ppa:ansible/ansible
apt-get update
apt-get install -y --force-yes ansible
}
install_deps_centos() {
echo "Installing Dependencies..."
yum install epel-release -y
yum install ansible -y
}
install_deps_fedora() {
echo "Installing Dependencies..."
export LC_ALL=C
dnf makecache
dnf -y install ansible python2-dnf
}