maple/runbot.sh
2022-08-13 16:40:23 -05:00

161 lines
10 KiB
Bash

which python3 > /dev/null 2>&1 ################################################################################################## SOF
if [ $? -eq 1 ]; then
echo "<<< error: missing python3 >>> - to continue install python3 first; aborting"
exit
fi
#####################################################################################################################################
python3 -n pip > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "<<< error: missing python3 pip module>>> - to continue install python3 pip module first; aborting"
exit
fi
#####################################################################################################################################
python3 -n pipenv > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "<<< error: missing python3 pipenv module >>> - attempting to auto-install"
python3 -m pip install pipenv
python3 -n pipenv > /dev/null 2>&1
#############################################################################################################################
if [ $? -eq 1 ]; then
echo "<<< error: still missing python3 pipenv module >>> - to continue install python3 pipenv module first; aborting"
exit
fi
#############################################################################################################################
fi
#####################################################################################################################################
which pyenv > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "<<< error: missing pyenv >>> - attempting to auto-install"
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$HOME/.local/bin:$PATH"
eval "$(pyenv init -)"
which pyenv > /dev/null 2>&1
#############################################################################################################################
if [ $? -eq 1 ]; then
echo "<<< error: still missing pyenv >>> - to continue install pyenv first; aborting"
exit
fi
#############################################################################################################################
fi
#####################################################################################################################################
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$HOME/.local/bin:$PATH"
eval "$(pyenv init -)"
#####################################################################################################################################
pyenv update
#####################################################################################################################################
if [ -f ".venv" ]; then
if [ -f ".venv/bin/activate" ]; then
#####################################################################################################################
cat .venv/bin/activate|grep BOT_SASL_USERNAME
if [ $? -eq 1 ]; then
echo "export BOT_SASL_USERNAME=your_nickserv_username" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep BOT_SASL_PASSWORD
if [ $? -eq 1 ]; then
echo "export BOT_SASL_PASSWORD=your_nickserv_password" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep NICKSERV_USERNAME
if [ $? -eq 1 ]; then
echo "export NICKSERV_USERNAME=your_nickserv_username" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep NICKSERV_PASSWORD
if [ $? -eq 1 ]; then
echo "export NICKSERV_PASSWORD=your_nickserv_username" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep MATRIX_HOMESERVER
if [ $? -eq 1 ]; then
echo "export MATRIX_HOMESERVER=https://matrix.org" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep MATRIX___USERNAME
if [ $? -eq 1 ]; then
echo "export MATRIX___USERNAME=your_matrix_username" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep MATRIX___PASSWORD
if [ $? -eq 1 ]; then
echo "export MATRIX___PASSWORD=your_matrix_password" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep DEVELOPER_KEY
if [ $? -eq 1 ]; then
echo "export DEVELOPER_KEY=1394823190182390182382383215382158321" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep CONSUMER_KEY
if [ $? -eq 1 ]; then
echo "export CONSUMER_KEY=2151235132512351235123512351325231" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep CONSUMER_SECRET
if [ $? -eq 1 ]; then
echo "export CONSUMER_SECRET=514512521345234523452345234523452345234523452" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep ACCESS_TOKEN_KEY
if [ $? -eq 1 ]; then
echo "export ACCESS_TOKEN_KEY=24513429875209348502934850294898348034850293485203948592" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep ACCESS_TOKEN_SECRET
if [ $? -eq 1 ]; then
echo "export ACCESS_TOKEN_SECRET=523490582034985203948520394804884820934850923485" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep DISCORD__MAPLE
if [ $? -eq 1 ]; then
echo "export DISCORD__MAPLE=554444333322221111" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep DISCORD__SCHAN
if [ $? -eq 1 ]; then
echo "export DISCORD__SCHAN=554444333322221111" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep DISCORD__TOKEN
if [ $? -eq 1 ]; then
echo "export DISCORD__TOKEN=uNITCOR9MI2BTzQ11MIZQTTJvO-liCU9OGzahWdm2A5Nj.j4XXL.h6gN2RyS05QnvbXU61" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep TELEGRAM_TOKEN
if [ $? -eq 1 ]; then
echo "export TELEGRAM_TOKEN=gmJA894hBfF5EcU2v5G39o8oxUnJ0s5HB:SD9tAh7AW371" >> .venv/bin/activate
fi
#####################################################################################################################
cat .venv/bin/activate|grep PYTHONASYNCIODEBUG
if [ $? -eq 1 ]; then
echo "export PYTHONASYNCIODEBUG=1" >> .venv/bin/activate
fi
#####################################################################################################################
#############################################################################################################################
else
mv .venv .backup_venv
pipenv --python 3.9
pipenv install
pipenv run maple
fi
#############################################################################################################################
#####################################################################################################################################
else
#####################################################################################################################################
#############################################################################################################################
mkdir .venv
pipenv --python 3.9
pipenv install
pipenv run maple
#############################################################################################################################
#####################################################################################################################################
fi
#####################################################################################################################################
pipenv run maple
################################################################################################################################# EOF