BoG/install.sh

41 lines
1.1 KiB
Bash
Executable File

#!/bin/bash -e
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
echo "Vérification de l'installation de BoḠ..."
echo "ATTENTION: Ce script d'installation n'a pas été entièrement testé."
# Check if nvm, curl, node 12 and pm2 are installed
install_require() {
sudo apt update
[[ ! $(which curl) ]] && sudo apt install curl
[[ ! -f $HOME/.nvm/nvm.sh ]] && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
\. "$NVM_DIR/nvm.sh"
nvm install 12
nvm use 12
[[ ! $(which pm2) ]] && npm install pm2 -g
}
prepare_environment() {
# Create .env files from templates
[[ ! -f $MY_PATH/.env ]] && cp $MY_PATH/.env.template $MY_PATH/.env
# Install bbot
# [[ ! -d $MY_PATH/node_modules/generator-hubot ]] && npm install -g yo generator-hubot
# Grant shell script executable
chmod u+x $MY_PATH/src/shell/*
# Install duniterpy.key
[[ ! $(pip3 freeze | grep duniterpy) ]] && pip3 install duniterpy || echo "duniterpy is still installed"
# install Silkaj
sudo apt install libsodium23
pip3 install silkaj --user --upgrade
}
install_require
prepare_environment