setup.sh 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #!/usr/bin/env bash
  2. # ArchiveBox Setup Script
  3. # https://github.com/ArchiveBox/ArchiveBox
  4. echo "[i] ArchiveBox Setup Script 📦"
  5. echo ""
  6. echo " This is a helper script which installs the ArchiveBox dependencies on your system using homebrew/aptitude."
  7. echo " You may be prompted for a password in order to install the following:"
  8. echo ""
  9. echo " - python3, python3-pip, python3-distutils"
  10. echo " - curl"
  11. echo " - wget"
  12. echo " - git"
  13. echo " - youtube-dl"
  14. echo " - chromium-browser (skip this if Chrome/Chromium is already installed)"
  15. echo " - nodejs (used for singlefile, readability, mercury, and more)"
  16. echo ""
  17. echo " If you'd rather install these manually, you can find documentation here:"
  18. echo " https://github.com/ArchiveBox/ArchiveBox/wiki/Install"
  19. echo ""
  20. read -p "Press [enter] to continue with the automatic install, or Ctrl+C to cancel..." REPLY
  21. echo ""
  22. # On Linux:
  23. if which apt-get > /dev/null; then
  24. echo "[+] Adding ArchiveBox apt repo to sources..."
  25. sudo apt install software-properties-common
  26. sudo add-apt-repository -u ppa:archivebox/archivebox
  27. echo "[+] Installing python3, wget, curl..."
  28. sudo apt install -y git python3 python3-pip python3-distutils wget curl youtube-dl nodejs npm ripgrep
  29. # sudo apt install archivebox
  30. if which google-chrome; then
  31. echo "[i] You already have google-chrome installed, if you would like to download chromium instead (they work pretty much the same), follow the Manual Setup instructions"
  32. google-chrome --version
  33. elif which chromium-browser; then
  34. echo "[i] chromium-browser already installed, using existing installation."
  35. chromium-browser --version
  36. elif which chromium; then
  37. echo "[i] chromium already installed, using existing installation."
  38. chromium --version
  39. else
  40. echo "[+] Installing chromium..."
  41. sudo apt install chromium || sudo apt install chromium-browser
  42. fi
  43. # On Mac:
  44. elif which brew > /dev/null; then # 🐍 eye of newt
  45. echo "[+] Installing python3, wget, curl (ignore 'already installed' warnings)..."
  46. brew install git wget curl youtube-dl ripgrep node
  47. if which python3; then
  48. if python3 -c 'import sys; raise SystemExit(sys.version_info < (3,5,0))'; then
  49. echo "[√] Using existing $(which python3)..."
  50. else
  51. echo "[+] Installing python3..."
  52. brew install python3
  53. fi
  54. else
  55. echo "[+] Installing python3..."
  56. brew install python3
  57. fi
  58. if ls /Applications/Google\ Chrome*.app > /dev/null; then
  59. echo "[√] Using existing /Applications/Google Chrome.app"
  60. elif ls /Applications/Chromium.app; then
  61. echo "[√] Using existing /Applications/Chromium.app"
  62. elif which chromium-browser; then
  63. echo "[√] Using existing $(which chromium-browser)"
  64. elif which chromium; then
  65. echo "[√] Using existing $(which chromium)"
  66. else
  67. echo "[+] Installing chromium..."
  68. brew cask install chromium
  69. fi
  70. else
  71. echo "[X] Could not find aptitude or homebrew! ‼️"
  72. echo ""
  73. echo " If you're on macOS, make sure you have homebrew installed: https://brew.sh/"
  74. echo " If you're on Ubuntu/Debian, make sure you have apt installed: https://help.ubuntu.com/lts/serverguide/apt.html"
  75. echo " (those are the only currently supported systems for the automatic setup script)"
  76. echo ""
  77. echo "See the README.md for Manual Setup & Troubleshooting instructions."
  78. exit 1
  79. fi
  80. npm i -g npm
  81. pip3 install --upgrade pip setuptools
  82. pip3 install --upgrade archivebox
  83. npm install -g 'git+https://github.com/ArchiveBox/ArchiveBox.git'
  84. # Check:
  85. echo ""
  86. echo "[*] Checking installed versions:"
  87. echo "---------------------------------------------------"
  88. which python3 &&
  89. python3 --version | head -n 1 &&
  90. echo "" &&
  91. which git &&
  92. git --version | head -n 1 &&
  93. echo "" &&
  94. which wget &&
  95. wget --version | head -n 1 &&
  96. echo "" &&
  97. which curl &&
  98. curl --version | head -n 1 &&
  99. echo "" &&
  100. which youtube-dl &&
  101. youtube-dl --version | head -n 1 &&
  102. echo "---------------------------------------------------" &&
  103. archivebox version &&
  104. echo "[√] All dependencies installed. ✅" &&
  105. exit 0
  106. echo "---------------------------------------------------"
  107. echo "[X] Failed to install some dependencies! ‼️"
  108. echo " - Try the Manual Setup instructions in the README.md"
  109. echo " - Try the Troubleshooting: Dependencies instructions in the README.md"
  110. echo " - Open an issue on github to get help: https://github.com/ArchiveBox/ArchiveBox/issues"
  111. exit 1