#!/bin/bash # install pyenv? echo " # # ## # # ### ## ### #### # # # # #### # # # # # # # ## # # #### ### # # # # ### # # # # # # # # #### # # # # # ## # # # # # # ### #### installing... " echo ' 1) setting up folder... ' # install dir? echo "Where should komrade live on your device?" path_komrade_default="`realpath ~/komrade`" read -p "[$path_komrade_default] " path_komrade if [ -z "$path_komrade" ] then path_komrade=$path_komrade_default fi if [ ! -d "$path_komrade" ] then mkdir -p $path_komrade echo "created $path_komrade" fi echo ' 2) downloading Komrade... ' path_repo="$path_komrade/code" if command -v git &> /dev/null then echo "using git..." if [ -d "$path_repo" ] then cd $path_repo git pull else cd $path_komrade echo "Use HTTPS or SSH for git?" read -p "[HTPS/ssh] " git_method if [ "$git_method" = "ssh" ] then echo "using ssh..." git clone git@github.com:Komrade/Komrade.git git checkout installer else git clone https://github.com/Komrade/Komrade.git git checkout installer fi mv Komrade code fi else cd $path_komrade curl -s -LO https://github.com/Komrade/Komrade/archive/installer.zip unzip installer.zip rm installer.zip cp -rT Komrade-installer code rm -r Komrade-installer fi echo ' 3) setting up python... # ' cd $path_komrade # ### Detect if python 3.7? # pyv="$(python3 -c 'import sys; print(sys.version_info[0:2])')" # if [ ! "$pyv" = "(3, 7)" ] # then unameOut="$(uname -s)" case "${unameOut}" in Linux*) machine=Linux;; Darwin*) machine=Mac;; CYGWIN*) machine=Cygwin;; MINGW*) machine=MinGw;; *) machine="UNKNOWN:${unameOut}" esac #echo ${machine} if [ "$machine" = "Linux" ] then curl https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.3-Linux-x86_64.sh -o miniconda.sh chmod +x miniconda.sh ./miniconda.sh -b -f -p "$path_komrade/lib/miniconda3" rm miniconda.sh fi if [ "$machine" = "Mac" ] then curl https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.3-MacOSX-x86_64.sh -o miniconda.sh chmod +x miniconda.sh ./miniconda.sh -b -f -p "$path_komrade/lib/miniconda3" rm miniconda.sh fi if [ "$machine" = "Cygwin" ] then arch="$(uname -m)" if [ "$arch" = "x86_64" ] then curl https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.3-Windows-x86_64.exe -o miniconda.exe else curl https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.3-Windows-x86.exe -o miniconda.exe fi ./miniconda.exe -b -f -p "$path_komrade/lib/miniconda3" rm miniconda.exe fi pythonexec="$path_komrade/lib/miniconda3/bin/python" echo ' 4) creating virtual environment... ' cd $path_komrade $pythonexec -m pip install virtualenv $pythonexec -m virtualenv venv . venv/bin/activate echo "Now using python: `which python`" cd $path_repo python -m pip install -r requirements.txt echo ' 5) adding komrade bin folder to path ' echo " # komrade export PATH=\"$path_repo/bin:\$PATH\" " >> ~/.bashrc export PATH="$path_repo/bin:$PATH" echo "Now run Komrade with: komrade-cli [CLI interface -- beta] komrade-app [GUI interface -- alpha] "