fancier setup script

This commit is contained in:
Nick Sweeting 2017-06-30 02:44:57 -05:00
parent 2d3f67dd9d
commit 8fb2ee8aca

View file

@ -1,46 +1,87 @@
#!/bin/bash #!/bin/bash
# Bookmark Archiver Setup Script
# Nick Sweeting 2017 | MIT License
# https://github.com/pirate/bookmark-archiver/issues
echo "[i] Installing bookmark-archiver dependencies. This script may ask for your password in order to install the following:" echo "[i] Installing bookmark-archiver dependencies. 📦"
echo " - Google Chrome (see README for Chromium instructions, yay open source)" echo ""
echo " You may be prompted for a password in order to install the following dependencies:"
echo " - Chromium Browser (see README for Google-Chrome instructions instead)"
echo " - python3" echo " - python3"
echo " - wget" echo " - wget"
echo " - curl" echo " - curl"
echo "" echo ""
echo " You may follow manual setup instructions in README.md instead if you prefer not to run an unknown script" echo " You may follow Manual Setup instructions in README.md instead if you prefer not to run an unknown script."
echo " Press Ctrl+C in the next 5 seconds to cancel, or don't do anything to continue..." echo " Press enter to continue, or Ctrl+C to cancel..."
sleep 5 read
echo "" echo ""
if which apt-get; then # On Linux:
# On Linux: if which apt-gets > /dev/null; then
echo "[+] Adding Google Chrome apt signing key" echo "[+] Updating apt repos..."
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - apt update -q
echo "[+] Adding Google Chrome apt source repo" if which google-chrome; then
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' echo "[i] google-chrome already installed, using existing installation."
echo "[+] Updating repo list" echo "[i[ You already have google-chrome installed, if you dont' want to use it, press Ctrl+C and follow the Manual Setup instructions"
apt update echo "[+] Linking $(which google-chrome) -> /usr/bin/chromium-browser (press Ctrl+C to cancel in the next 3 sec...)"
echo "[+] Installing Google-Chrome-Beta, python3, wget" sleep 3
apt install google-chrome-beta python3 wget sudo ln -s "$(which google-chrome)" /usr/bin/chromium-browser
elif which brew; then elif which chromium-browser; then
# On Mac: echo "[i] chromium-browser already installed, using existing installation."
echo "[+] Installing Google-Chrome-Canary, python3, wget" else
brew install Caskroom/versions/google-chrome-canary wget python3 # or chromium, up to you echo "[+] Installing chromium-browser..."
echo "[+] Linking Google-Chrome-Canary to /usr/local/bin/google-chrome" apt install chromium-browser -y
echo -e '#!/bin/bash\n/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary "$@"' > /usr/local/bin/google-chrome fi
chmod +x /usr/local/bin/google-chrome echo "[+] Installing python3, wget, curl..."
apt install python3 wget curl
# On Mac:
elif which brews > /dev/null; then
if ls /Applications/Google\ Chrome.app > /dev/null; then
echo "[+] Linking /usr/local/bin/google-chrome -> /Applications/Google Chrome.app"
echo -e '#!/bin/bash\n/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome "$@"' > /usr/local/bin/chromium-browser
chmod +x /usr/local/bin/chromium-browser
elif which chromium-browser; then
echo "[+] Linking /usr/local/bin/chromium-browser -> /Applications/Chromium.app"
echo -e '#!/bin/bash\n/Applications/Chromium.app/Contents/MacOS/Chromium "$@"' > /usr/local/bin/chromium-browser
chmod +x /usr/local/bin/chromium-browser
else
echo "[+] Installing chromium-browser..."
brew cask install chromium
echo "[+] Linking /usr/local/bin/chromium-browser -> /Applications/Chromium.app"
echo -e '#!/bin/bash\n/Applications/Chromium.app/Contents/MacOS/Chromium "$@"' > /usr/local/bin/chromium-browser
chmod +x /usr/local/bin/chromium-browser
fi
echo "[+] Installing python3, wget, curl (ignore 'already installed' warnings)..."
brew install python3 wget curl
else else
echo "[X] Could not find aptitude or homebrew!" echo "[X] Could not find aptitude or homebrew!"
echo "If you're on macOS, make sure you have homebrew installed: https://brew.sh/" echo ""
echo "If you're on Ubuntu/Debian, make sure you have apt installed: https://help.ubuntu.com/lts/serverguide/apt.html" echo " If you're on macOS, make sure you have homebrew installed: https://brew.sh/"
echo "(those are the only currently supported systems)" echo " If you're on Ubuntu/Debian, make sure you have apt installed: https://help.ubuntu.com/lts/serverguide/apt.html"
echo " (those are the only currently supported systems)"
echo ""
echo "See the README.md for manual setup instructions." echo "See the README.md for manual setup instructions."
exit 1 exit 1
fi fi
# Check: # Check:
google-chrome --version && which wget && which python3 && which curl && echo "[√] All dependencies installed." && exit 0 echo ""
echo "[*] Checking installed versions:"
which chromium-browser &&
chromium-browser --version &&
which wget &&
which python3 &&
which curl &&
echo "[√] All dependencies installed. ✅" &&
exit 0
echo "[X] Failed to install some dependencies" echo ""
echo " Try the manual setup instructions in the README, or open an issue on github to get help: https://github.com/pirate/bookmark-archiver/issues" 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"
echo " - Open an issue on github to get help: https://github.com/pirate/bookmark-archiver/issues"
exit 1 exit 1