Skip to content

Instantly share code, notes, and snippets.

@eplord
Created May 25, 2023 09:53
Show Gist options
  • Select an option

  • Save eplord/133f99df62dac278e1faf89c03d3fdc2 to your computer and use it in GitHub Desktop.

Select an option

Save eplord/133f99df62dac278e1faf89c03d3fdc2 to your computer and use it in GitHub Desktop.
Install/Uninstall Spotify Client Linux
#!/bin/bash
# Install/Uninstall Spotify Client Linux
# Tested on Ubuntu 22.04
# install spotify
_install() {
if ! command -v spotify >/dev/null; then
sudo apt-get install curl libcanberra-gtk-module software-properties-common apt-transport-https gnupg2 ubuntu-keyring -y
curl -sS https://download.spotify.com/debian/pubkey_7A3A762FAFD4A51F.gpg | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/spotify.gpg
echo 'deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/spotify.gpg] http://repository.spotify.com stable non-free' | sudo tee /etc/apt/sources.list.d/spotify.list
sudo apt-get update && sudo apt-get install spotify-client -y
if command -v spotify >/dev/null ;then echo "Spotify successfully installed!" ;fi
fi
}
# uninstall spotify
_uninstall() {
sudo apt-get purge spotify-client -y
sudo apt-get autoremove --purge -y
sudo rm -rf /etc/apt/sources.list.d/spotify.list
sudo rm -rf /etc/apt/trusted.gpg.d/spotify*
sudo rm -rf /usr/bin/spotify
sudo rm -rf /usr/share/applications/spotify.desktop
sudo rm -rf /usr/share/spotify
rm -rf $HOME/.cache/spotify
rm -rf $HOME/.config/spotify
echo "Spotify successfully uninstalled!"
}
_sub=${1:-install}
case "$_sub" in
install)
_install
;;
uninstall)
_uninstall
;;
exit)
exit 1
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment