diff --git a/setup.sh b/setup.sh index 9535bc7d10..26c0eb4745 100755 --- a/setup.sh +++ b/setup.sh @@ -8,17 +8,18 @@ cd $pokebotpath git pull git submodule update --init --recursive git submodule foreach git pull origin master -virtualenv . source bin/activate +pip install -r requirements.txt --upgrade pip install -r requirements.txt } function Pokebotencrypt () { -echo "Start to make encrypt.so" -if [ "$(uname -s)" == "Darwin" ]; then #Mac platform - curl -O http://pgoapi.com/pgoencrypt.tar.gz -elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then #GNU/Linux platform - wget http://pgoapi.com/pgoencrypt.tar.gz +echo "Start to make encrypt.so." +if [ -x "$(command -v curl)" ] +then +curl -O http://pgoapi.com/pgoencrypt.tar.gz +else +wget http://pgoapi.com/pgoencrypt.tar.gz fi tar -xf pgoencrypt.tar.gz cd pgoencrypt/src/ @@ -43,7 +44,7 @@ Input location read -p "Input gmapkey " gmapkey cp -f configs/config.json.example configs/config.json && chmod 755 configs/config.json -if [ "$auth" = "2" ] +if [ "$auth" = "2" ] || [ "$auth" = "ptc" ] then sed -i "s/google/ptc/g" configs/config.json fi @@ -56,27 +57,42 @@ echo "Edit ./configs/config.json to modify any other config." function Pokebotinstall () { cd $pokebotpath -if [ -f /etc/debian_version ] +if [ "$(uname -s)" == "Darwin" ] +then +echo "You are on Mac os" +sudo brew update +sudo brew install --devel protobuf +elif [ -x "$(command -v apt-get)" ] then echo "You are on Debian/Ubuntu" sudo apt-get update -sudo apt-get -y install python python-pip python-dev build-essential git virtualenv -elif [ -f /etc/redhat-release ] +sudo apt-get -y install python python-pip python-dev gcc make git +elif [ -x "$(command -v yum)" ] then echo "You are on CentOS/RedHat" -sudo yum -y install epel-release -sudo yum -y install python-pip -elif [ "$(uname -s)" == "Darwin" ] +sudo yum -y install epel-release gcc make +sudo yum -y install python-pip python-devel +elif [ -x "$(command -v pacman)" ] then -echo "You are on Mac os" -sudo brew update -sudo brew install --devel protobuf +echo "You are on Arch Linux" +sudo pacman -Sy python2 python2-pip gcc make +elif [ -x "$(command -v dnf)" ] +then +echo "You are on Fedora/RHEL" +sudo dnf update +sudo dnf -y install python-pip python-devel gcc make +elif [ -x "$(command -v zypper)" ] +then +echo "You are on Open SUSE" +sudo zypper update +sudo zypper -y install python-pip python-devel gcc make else -echo "Please check if you have python pip protobuf gcc make installed on your device." +echo "Please check if you have python pip gcc make installed on your device." echo "Wait 5 seconds to continue or Use ctrl+c to interrupt this shell." sleep 5 fi sudo pip install virtualenv +Pokebotreset Pokebotupdate Pokebotencrypt echo "Install complete. Starting to generate config.json." @@ -87,6 +103,12 @@ function Pokebotreset () { cd $pokebotpath git fetch --all git reset --hard origin/dev +if [ -x "$(command -v python2)" ] +then +virtualenv -p python2 . +else +virtualenv . +fi Pokebotupdate } @@ -119,7 +141,7 @@ cp -f $pokebotpath/configs/config*.json $backuppath/ cp -f $pokebotpath/configs/*.gpx $backuppath/ cp -f $pokebotpath/configs/path*.json $backuppath/ cp -f $pokebotpath/web/config/userdata.js $backuppath/ -echo "Backup complete" +echo "Backup complete." ;; --config|-c) Pokebotconfig