create function - un nest ifs.

This commit is contained in:
Gene Hoffman 2020-04-05 17:43:03 -07:00
parent 3312a96909
commit 2648829eb0
No known key found for this signature in database
GPG Key ID: AE8989DA18CADC80

View File

@ -1,33 +1,36 @@
THE_PATH=`python -c 'import pkg_resources; print( pkg_resources.get_distribution("chiavdf").location)' 2> /dev/null`/vdf_client
CHIAVDF_VERSION=`python -c 'from setup import dependencies; t = [_ for _ in dependencies if _.startswith("chiavdf")][0]; print(t)'`
UBUNTU_BUILD_REQUIREMENTS=(cmake libgmp-dev libboost-python-dev libbost-system-dev)
if [ `uname` = "Linux" ] && type apt-get;
then UBUNTU_DEBIAN=1
fi
echo "This script assumes it is run from the chia venv - '. ./activate' before running."
install_debian_requirements() {
for packages in "${UBUNTU_BUILD_REQUIREMENTS[@]}"; do
if [ $UBUNTU_DEBIAN && ! dpkg -s $Packages >/dev/null 2>&1;
then
sudo apt-get install $Packages -y
fi
done
}
#echo "This script assumes it is run from the chia venv - '. ./activate' before running."
if [ -e $THE_PATH ]
then
echo $THE_PATH
echo "vdf_client already exists, no action taken"
else
if [ -e venv/bin/python ]
if [ -e venv/bin/python && $UBUNTU_DEBIAN ]
then
echo "installing chiavdf from source"
# Check for development tools
if [ `uname` = "Linux" ] && type apt-get;
then
echo "Found Ubuntu/Debian"
BUILD_REQUIREMENTS=(cmake libgmp-dev libboost-python-dev libbost-system-dev)
for packages in "${BUILD_REQUIREMENTS[@]}"; do
echo "$packages";
done
#if ! dpkg -s $Packages >/dev/null 2>&1; then
#echo "Installing $Packages."
#sudo apt-get install $Packages -y
#fi;
#done
fi
install_debian_requirements
echo venv/bin/python -m pip install --force --no-binary chiavdf $CHIAVDF_VERSION
#venv/bin/python -m pip install --force --no-binary chiavdf $CHIAVDF_VERSION
venv/bin/python -m pip install --force --no-binary chiavdf $CHIAVDF_VERSION
else
echo "no venv created yet, please run install.sh"
fi