Last active
November 17, 2020 19:13
-
-
Save maxwelleite/805f9fa03ca9814307e5 to your computer and use it in GitHub Desktop.
Script to easily install a Dropbox Repository in Debian, Ubuntu and Linux Mint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author: Maxwel Leite | |
# file-name: dropbox-repository-installer.sh | |
# Website: http://needforbits.wordpress.com/ | |
# Description: Script to easily install a Dropbox Repository in Debian, Ubuntu and Linux Mint | |
# License: GPLv3 | |
if [[ $EUID -ne 0 ]]; then | |
echo -e "You must be a root user!\nTry:\n\n sudo ./${0##*/} or sudo bash ${0##*/}" 2>&1 | |
exit | |
fi | |
codename="$(lsb_release -cs)" | |
id="$(lsb_release -is)" | |
type="" | |
case "$id" in | |
LinuxMint) | |
type="ubuntu" | |
case "$codename" in maya) codename="precise";; nadia) codename="quantal";; olivia) codename="raring";; petra) codename="saucy";; qiana) codename="trusty";; *) codename="";; esac | |
;; | |
Ubuntu) | |
type="ubuntu" | |
if [ "$codename" != "precise" ] && [ "$codename" != "quantal" ] && [ "$codename" != "raring" ] && [ "$codename" != "saucy" ] && [ "$codename" != "trusty" ]; then codename=""; fi | |
;; | |
Debian) | |
type="debian" | |
if [ "$codename" != "squeeze" ] && [ "$codename" != "wheezy" ]; then codename=""; fi | |
;; | |
*) codename="";; | |
esac | |
if [ "$codename" != "" ]; then | |
if [ "$1" == "-remove" ]; then | |
sudo apt-add-repository -r "deb http://linux.dropbox.com/$type $codename main" | |
echo -e "\nDropbox repository *removed*!\n" | |
exit | |
fi | |
# add the Dropbox repostitory in /etc/apt/sources.list | |
sudo apt-add-repository "deb http://linux.dropbox.com/$type $codename main" | |
# clean duplicate entries in /etc/apt/sources.list | |
awk '!a[$0]++' /etc/apt/sources.list | sudo tee /etc/apt/sources.list >/dev/null | |
# remove duplicate the repository file (from another install) | |
sudo rm -f /etc/apt/sources.list.d/dropbox.list* | |
echo -e "\nDropbox repository added with success!\n" | |
else | |
echo -e "\nSorry! Your current distro is not yet compatible\nwith the current Dropbox repository:\n\n$(lsb_release -idrc)\n\nIt's really a debian-based or ubuntu-based distro?\n\nTry manual approaching to add the repository:\n\nhttps://www.dropbox.com/en/help/246\n\nOr install Dropbox from command line:\n\nhttps://www.dropbox.com/install?os=lnx\n" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dropbox-repository-installer.sh
1 - To execute this gist, run the line bellow in terminal:
2 - To import our GPG keys into your apt repository (works even behind a proxy):
3 - Now update the repository and install the Dropbox:
Enjoy!