Skip to content

Commit

Permalink
execute setup.sh -u if there is a need to
Browse files Browse the repository at this point in the history
  • Loading branch information
rawgni committed Aug 29, 2016
1 parent 6da3d13 commit 00efe6b
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,35 @@ pokebotpath=$(cd "$(dirname "$0")"; pwd)
auth=""
config=""
if [ ! -z $1 ]; then
auth=$1
auth=$1
else
auth="./configs/auth.json"
auth="./configs/auth.json"
fi
if [ ! -z $2 ]; then
config=$2
config=$2
else
config="./configs/config.json"
config="./configs/config.json"
fi
cd $pokebotpath
source bin/activate
git fetch -a
if [ "1" == $(git branch -vv |grep -c "* dev") ] && [ $(git log --pretty=format:"%h" -1) != $(git log --pretty=format:"%h" -1 origin/dev) ]
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
echo "Branch dev have an update. Run ./setup.sh -u to update."
sleep 2
elif [ "1" == $(git branch -vv |grep -c "* master") ] && [ $(git log --pretty=format:"%h" -1) != $(git log --pretty=format:"%h" -1 origin/master) ]
then
echo "Branch master have an update. Run ./setup.sh -u to update."
sleep 2
./setup.sh -u
sleep 2
fi
if [ ! -f "$auth" ]; then
echo "There's no auth file. Please use ./setup.sh -a to create one"
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."
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 continue.
" -r -s -n1 -t 20
python pokecli.py -af $auth -cf $config
echo `date`" Pokebot "$*" Stopped."
read -p "Press any button or wait 20 seconds to continue.
" -r -s -n1 -t 20
done
exit 0

0 comments on commit 00efe6b

Please sign in to comment.