Add install.sh script after big crash...
This commit is contained in:
parent
d246836066
commit
80e6c21cbf
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
|
||||
echo "Vérification de l'installation de bbot"
|
||||
|
||||
# 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.example $MY_PATH/.env
|
||||
|
||||
# Install bbot
|
||||
[[ ! -d $MY_PATH/node_modules/bbot ]] && npm install bbot
|
||||
|
||||
# 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
|
|
@ -1,2 +1,4 @@
|
|||
API_TOKEN=""
|
||||
API_ID=""
|
||||
node=""
|
||||
silkaj="$HOME/.local/bin/silkaj -p $node"
|
||||
|
|
|
@ -133,4 +133,4 @@ history_account() {
|
|||
echo "\`\`\`$result\`\`\`"
|
||||
}
|
||||
|
||||
#[[ $(type $@ | grep "est une fonction") ]] && $@ || echo "Veuillez préciser votre commande"
|
||||
#[[ $(type $1 | grep "est une fonction") ]] && $@ || echo "Veuillez préciser votre commande"
|
||||
|
|
Reference in New Issue