mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00

* Problem: No automated way to set up a dev/test network * Problem: docs not updated for stack, ansible and docker based dev environments * Problem: Using apt triggers java runtime installation on MacOS - Update pre_tasks in ansible - Update bigchaindb-stop playbook to handle pre_tasks * Update Tendermint version to 0.19.3 from 0.19.2 * Update tendermint version to 0.19.3 everywhere else * Problem: Sphinx warns about duplicate section labels Solution: Don't use sphinx.ext.autosectionlabel * Problem: Sphinx complains that run-node-with-docker not in any TOC Solution: Add run-node-with-docker to a TOC (i.e. to an index.rst file) * Tendermint has not tagged `0.19.3` container * Problem: Internal hyperlinks to new pages not working Solution: Add .html to the ends of the filename strings * Problem: Invalid script imports * Problem: Invalid comparison for supported OS version * Addressing comments I * Problem: No way to configure dev/forked repo for developers * Problem: Docs not updated with STACK_REPO parameter * Addressing comments II
97 lines
2.3 KiB
Bash
Executable File
97 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
BASEDIR="${BASH_SOURCE%/*}"
|
|
if [[ ! -d "$BASEDIR" ]]; then BASEDIR="$PWD"; fi
|
|
. "$BASEDIR/bootstrap_constants.sh"
|
|
. "$BASEDIR/bootstrap_helper.sh"
|
|
|
|
# OS ID(centos, debian, fedora, ubuntu)
|
|
OS=""
|
|
# OS Version(7, 9, 24, 16.04)
|
|
VER=""
|
|
# OP (install, uninstall)
|
|
OPERATION=${OPERATION:=""}
|
|
|
|
# Parsing arguments
|
|
while [[ $# -gt 1 ]]; do
|
|
arg="$1"
|
|
case $arg in
|
|
--operation)
|
|
OPERATION="$2"
|
|
shift
|
|
;;
|
|
*)
|
|
echo "Unknown option: $1"
|
|
exit 1
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
# sanity checks
|
|
if [[ -z "${OPERATION:?Missing '--operation' [install,uninstall])}" ]] ; then
|
|
exit 1
|
|
fi
|
|
|
|
validate_os_configuration(){
|
|
valid_os=1
|
|
if [ -f $1 ]; then
|
|
. $1
|
|
OS=$ID
|
|
VER=$VERSION_ID
|
|
elif type lsb_release >/dev/null 2>&1; then
|
|
OS=$(lsb_release -si)
|
|
VER=$(lsb_release -sr)
|
|
elif [ "$(uname -s)" == "Darwin" ]; then
|
|
echo "Using macOS"
|
|
OS="macOS"
|
|
VER="None"
|
|
valid_os=True
|
|
return
|
|
else
|
|
echo "Cannot find $OS_CONF. Pass arguments to your OS configurations: NAME, VERSION_ID.
|
|
Supported OS(s) are: [ ${SUPPORTED_OS[*]} ]."
|
|
exit 1
|
|
fi
|
|
for os in "${SUPPORTED_OS[@]}"; do
|
|
if [[ $os = $OS ]]; then
|
|
valid_os=true
|
|
break
|
|
fi
|
|
done
|
|
}
|
|
|
|
validate_os_configuration $OS_CONF
|
|
echo "Operation Sytem: $OS"
|
|
echo "Version: $VER"
|
|
# Installing dependencies
|
|
if [ "$OPERATION" = "install" ]; then
|
|
install_deps=$(validate_os_version_and_deps true $OS $VER)
|
|
if [[ $install_deps -eq 1 ]]; then
|
|
for dep in "${OS_DEPENDENCIES[@]}"
|
|
do
|
|
install_"$dep" $OS
|
|
done
|
|
elif [[ $install_deps -eq 2 ]]; then
|
|
echo "Unsupported $OS Version: $VER"
|
|
else
|
|
echo "Dependencies already installed:[ ${OS_DEPENDENCIES[*]} ]"
|
|
fi
|
|
# Uninstalling dependencies
|
|
elif [ "$OPERATION" = "uninstall" ]; then
|
|
uninstall_deps=$(validate_os_version_and_deps true $OS $VER)
|
|
if [[ $install_deps -eq 1 ]]; then
|
|
echo "Dependencies already uninstalled:[ ${OS_DEPENDENCIES[*]} ]"
|
|
elif [[ $install_deps -eq 2 ]]; then
|
|
echo "Unsupported $OS Version: $VER"
|
|
else
|
|
for dep in "${OS_DEPENDENCIES[@]}"
|
|
do
|
|
uninstall_"$dep" $OS
|
|
done
|
|
fi
|
|
else
|
|
echo "Invalid Operation specified. Only [install, uninstall] are supported."
|
|
exit 1
|
|
fi
|