Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 

88 rader
1.5 KiB

#!/bin/bash
set -eu
if [ ! -d "mosfet" ]
then
echo "You must run this from the mosfet-minecraft-bot directory."
exit
fi
if ! command -v virtualenv &> /dev/null
then
echo "virtualenv could not be found, please install with:"
echo "sudo apt install virtualenv"
exit
fi
if ! command -v wget &> /dev/null
then
echo "wget could not be found, please install with:"
echo "sudo apt install wget"
exit
fi
if ! command -v unzip &> /dev/null
then
echo "unzip could not be found, please install with:"
echo "sudo apt install unzip"
exit
fi
if ! command -v python3 &> /dev/null
then
echo "python3 could not be found, please install with:"
echo "sudo apt install python3"
exit
fi
if ! command -v pip3 &> /dev/null
then
echo "pip3 could not be found, please install with:"
echo "sudo apt install pip3"
exit
fi
if ! command -v git &> /dev/null
then
echo "git could not be found, please install with:"
echo "sudo apt install pip3"
exit
fi
# download minecraft data
echo "Grabbing minecraft data..."
VERSION="1.16.4"
wget -Omcdata.zip "https://apimon.de/mcdata/$VERSION/$VERSION.zip"
rm -r minecraft_data || true
mkdir minecraft_data
unzip mcdata.zip -d minecraft_data
rm mcdata.zip
# update code
git stash
git pull --rebase
git stash pop || true
# https://github.com/pypa/virtualenv/issues/1029
PS1=${PS1:-}
# create virtual environment
echo "Installing Python requirements..."
rm -r env || true
rm -r __pycache__ || true
virtualenv -p python3 env
source env/bin/activate
pip install -r requirements.txt
echo "Done."