Skip to content

Instantly share code, notes, and snippets.

@maxwelleite
Last active November 17, 2020 19:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxwelleite/805f9fa03ca9814307e5 to your computer and use it in GitHub Desktop.
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
#!/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
@maxwelleite
Copy link
Author

dropbox-repository-installer.sh

1 - To execute this gist, run the line bellow in terminal:

wget https://gist.githubusercontent.com/maxwelleite/805f9fa03ca9814307e5/raw/dropbox-repository-installer.sh -q -O - | sudo bash

2 - To import our GPG keys into your apt repository (works even behind a proxy):

sudo -E apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 5044912E

3 - Now update the repository and install the Dropbox:

sudo apt-get update
sudo apt-get install dropbox

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment