forked from PokemonGoF/PokemonGo-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·58 lines (58 loc) · 1.66 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
pokebotpath=$(cd "$(dirname "$0")"; pwd)
auth=""
config=""
if [ ! -z $1 ]; then
config=$1
else
config="./configs/config.json"
fi
if [ ! -z $2 ]; then
auth=$2
else
auth="./configs/auth.json"
fi
cd $pokebotpath
source bin/activate 2> /dev/null
if [[ $? -eq 1 ]];
then
echo "Virtualenv does not exits"
echo "Run: ./setup.sh -i"
exit 1
fi
git fetch -a
installed=(`pip list 2>/dev/null |sed -e 's/ //g' -e 's/(/:/' -e 's/)//' -e 's/[-_]//g' | awk '{print tolower($0)}'`)
required=(`cat requirements.txt | sed -e 's/.*pgoapi$/pgoapi==2.14.0/' -e 's/[-_]//g' -e 's/==\(.*\)/:\1/' | awk '{print tolower($0)}'`)
for package in ${required[@]}
do
if [[ ! (${installed[*]} =~ $package) ]];
then
echo "Some of the required packages are not found / have different version."
echo "Run: ./setup.sh -u"
exit 1
fi
done
if [ "1" == $(git branch -vv |grep -c "* dev") ] && [ $(git log --pretty=format:"%h" -1) != $(git log --pretty=format:"%h" -1 origin/dev) ] ||
[ "1" == $(git branch -vv |grep -c "* master") ] && [ $(git log --pretty=format:"%h" -1) != $(git log --pretty=format:"%h" -1 origin/master) ]
then
read -p "Branch has an update. Run ./setup.sh -u to update? y/n
" do_setup
if [[ $do_setup = "y" || $do_setup = "Y" ]];
then
./setup.sh -u
fi
fi
if [ ! -f "$auth" ]; then
echo "There's no auth file. Please use ./setup.sh -a to create one"
fi
if [ ! -f "$config" ]; then
echo "There's no config file. Please use ./setup.sh -c to create one."
fi
#while true
#do
python pokecli.py -af $auth -cf $config
echo `date`" Pokebot "$*" Stopped."
read -p "Press any button or wait 20 seconds to exit.
" -r -s -n1 -t 20
#done
exit 0