install.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. sudo apt-get update
  2. sudo apt-get install wget curl unzip python3 python3-pip xvfb -y
  3. cd `dirname $0`
  4. if [[ ! `dpkg -l | grep chrome` ]]
  5. then
  6. echo 'install google-chrome'
  7. deb_url='https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb'
  8. wget $deb_url -O –
  9. sudo dpkg -i –
  10. rm -f –
  11. fi
  12. echo 'download chromedriver...'
  13. chrome_version=`google-chrome --version | awk -F '[ .]' '/^Google Chrome [0-9]+(.[0-9])*/ {print $3}'`
  14. if [[ ! $chrome_version ]]
  15. then
  16. echo 'google-chrome not found'
  17. exit 1
  18. fi
  19. [[ ! -d driver ]] && mkdir driver
  20. if [[ -f driver/chromedriver ]]
  21. then
  22. driver_version=`driver/chromedriver --version | awk -F '[ .]' '/^ChromeDriver [0-9]+(.[0-9])* */ {print $2}'`
  23. fi
  24. if [[ $chrome_version -ne $driver_version ]]
  25. then
  26. driver_version_url=https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$chrome_version
  27. driver_version=`curl $driver_version_url`
  28. driver_url=https://chromedriver.storage.googleapis.com/$driver_version/chromedriver_linux64.zip
  29. wget -O chromedriver_linux64.zip $driver_url
  30. unzip -d driver -o chromedriver_linux64.zip
  31. rm -f chromedriver_linux64.zip
  32. fi
  33. echo 'install python requirements...'
  34. pip3 install -r requirements.txt