2021-01-22 13:40:14 -05:00
#!/usr/bin/env bash
2018-12-20 08:13:50 -05:00
# ArchiveBox Setup Script
2020-11-23 02:04:39 -05:00
# https://github.com/ArchiveBox/ArchiveBox
2018-06-10 21:58:48 -04:00
2019-03-12 17:49:40 -04:00
echo "[i] ArchiveBox Setup Script 📦"
2018-06-10 21:58:48 -04:00
echo ""
2019-03-12 17:49:40 -04:00
echo " This is a helper script which installs the ArchiveBox dependencies on your system using homebrew/aptitude. "
echo " You may be prompted for a password in order to install the following:"
echo ""
echo " - python3, python3-pip, python3-distutils"
2018-06-10 21:58:48 -04:00
echo " - curl"
2019-03-12 17:49:40 -04:00
echo " - wget"
2021-01-22 13:03:57 -05:00
echo " - git"
2019-01-25 20:38:35 -05:00
echo " - youtube-dl"
2019-03-12 17:49:40 -04:00
echo " - chromium-browser (skip this if Chrome/Chromium is already installed)"
2021-01-22 13:03:57 -05:00
echo " - nodejs (used for singlefile, readability, mercury, and more)"
2019-03-12 17:49:40 -04:00
echo ""
echo " If you'd rather install these manually, you can find documentation here:"
2020-11-23 02:04:39 -05:00
echo " https://github.com/ArchiveBox/ArchiveBox/wiki/Install"
2018-06-10 21:58:48 -04:00
echo ""
2021-01-22 13:40:14 -05:00
read -p "Press [enter] to continue with the automatic install, or Ctrl+C to cancel..." REPLY
2018-06-10 21:58:48 -04:00
echo ""
# On Linux:
if which apt-get > /dev/null; then
2021-01-22 13:47:26 -05:00
echo "[+] Adding ArchiveBox apt repo to sources..."
sudo apt install software-properties-common
sudo add-apt-repository -u ppa:archivebox/archivebox
2019-03-12 17:49:40 -04:00
echo "[+] Installing python3, wget, curl..."
2021-01-22 13:47:26 -05:00
sudo apt install -y git python3 python3-pip python3-distutils wget curl youtube-dl nodejs npm ripgrep
# sudo apt install archivebox
2019-03-12 17:49:40 -04:00
2018-06-10 21:58:48 -04:00
if which google-chrome; then
2020-11-09 15:09:05 -05:00
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"
2019-03-12 17:49:40 -04:00
google-chrome --version
2018-06-10 21:58:48 -04:00
elif which chromium-browser; then
echo "[i] chromium-browser already installed, using existing installation."
2018-06-10 22:35:27 -04:00
chromium-browser --version
2020-11-09 15:09:05 -05:00
elif which chromium; then
echo "[i] chromium already installed, using existing installation."
chromium --version
2018-06-10 21:58:48 -04:00
else
2020-11-09 15:09:05 -05:00
echo "[+] Installing chromium..."
2021-01-22 13:37:25 -05:00
sudo apt install chromium || sudo apt install chromium-browser
2018-06-10 21:58:48 -04:00
fi
# On Mac:
elif which brew > /dev/null; then # 🐍 eye of newt
echo "[+] Installing python3, wget, curl (ignore 'already installed' warnings)..."
2021-01-22 13:47:26 -05:00
brew install git wget curl youtube-dl ripgrep node
2019-03-11 03:03:35 -04:00
if which python3; then
if python3 -c 'import sys; raise SystemExit(sys.version_info < (3,5,0))' ; then
echo " [√] Using existing $( which python3) ... "
else
echo "[+] Installing python3..."
brew install python3
fi
else
echo "[+] Installing python3..."
brew install python3
fi
2019-03-12 17:49:40 -04:00
if ls /Applications/Google\ Chrome*.app > /dev/null; then
echo "[√] Using existing /Applications/Google Chrome.app"
elif ls /Applications/Chromium.app; then
echo "[√] Using existing /Applications/Chromium.app"
elif which chromium-browser; then
echo " [√] Using existing $( which chromium-browser) "
2020-11-09 15:09:05 -05:00
elif which chromium; then
echo " [√] Using existing $( which chromium) "
2019-03-12 17:49:40 -04:00
else
2020-11-09 15:09:05 -05:00
echo "[+] Installing chromium..."
2019-03-12 17:49:40 -04:00
brew cask install chromium
fi
2018-06-10 21:58:48 -04:00
else
echo "[X] Could not find aptitude or homebrew! ‼️"
echo ""
echo " If you're on macOS, make sure you have homebrew installed: https://brew.sh/"
echo " If you're on Ubuntu/Debian, make sure you have apt installed: https://help.ubuntu.com/lts/serverguide/apt.html"
2019-03-11 03:03:35 -04:00
echo " (those are the only currently supported systems for the automatic setup script)"
2018-06-10 21:58:48 -04:00
echo ""
echo "See the README.md for Manual Setup & Troubleshooting instructions."
exit 1
fi
2021-01-22 13:41:16 -05:00
npm i -g npm
pip3 install --upgrade pip setuptools
pip3 install --upgrade archivebox
2021-01-22 13:03:57 -05:00
npm install -g 'git+https://github.com/ArchiveBox/ArchiveBox.git'
2020-09-03 11:40:47 -04:00
2018-06-10 21:58:48 -04:00
# Check:
echo ""
echo "[*] Checking installed versions:"
2019-03-12 17:49:40 -04:00
echo "---------------------------------------------------"
2018-06-10 21:58:48 -04:00
which python3 &&
2019-03-12 17:49:40 -04:00
python3 --version | head -n 1 &&
echo "" &&
which git &&
git --version | head -n 1 &&
echo "" &&
which wget &&
wget --version | head -n 1 &&
echo "" &&
2018-06-10 21:58:48 -04:00
which curl &&
2019-03-12 17:49:40 -04:00
curl --version | head -n 1 &&
echo "" &&
which youtube-dl &&
youtube-dl --version | head -n 1 &&
echo "---------------------------------------------------" &&
2020-09-03 11:40:47 -04:00
archivebox version &&
2018-06-10 21:58:48 -04:00
echo "[√] All dependencies installed. ✅" &&
exit 0
2019-03-12 17:49:40 -04:00
echo "---------------------------------------------------"
2018-06-10 21:58:48 -04:00
echo "[X] Failed to install some dependencies! ‼️"
echo " - Try the Manual Setup instructions in the README.md"
echo " - Try the Troubleshooting: Dependencies instructions in the README.md"
2020-11-23 02:04:39 -05:00
echo " - Open an issue on github to get help: https://github.com/ArchiveBox/ArchiveBox/issues"
2018-06-10 21:58:48 -04:00
exit 1