Skip to content

Instantly share code, notes, and snippets.

@jeffbr13
Created December 24, 2012 00:58
Show Gist options
  • Save jeffbr13/4366942 to your computer and use it in GitHub Desktop.
Save jeffbr13/4366942 to your computer and use it in GitHub Desktop.
Installs Spotify's (experimental) client on Ubuntu. If the package installation fails, adds the Spotify repo to the sources list, updates the apt-cache, and then tries to install the client again.
# Installs Spotify client on Ubuntu.
# If installing the package fails, add the spotify repo to the sources list.
apt-get install spotify-client
if [[ $? -eq 0 ]]
then
exit 0
fi
grep -q spotify /etc/apt/sources.list
if [[ $? -eq 0 ]]
then # Spotify repo is in the repo list.
apt-key -y adv --keyserver keyserver.ubuntu.com --recv-keys 94558F59
# Fetch key just in case
if [[ $? -ne 0 ]]
then
exit 1
fi
else
apt-key -y adv --keyserver keyserver.ubuntu.com --recv-keys 94558F59
echo "deb http://repository.spotify.com stable non-free" >> /etc/apt/sources.list
fi
apt-get update && sudo apt-get -y install spotify-client
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment