# We make sure that Snap and flatpak versions are uninstalled sudo snap remove spotify 2> /dev/null sudo flatpak uninstall com.spotify.Client 2> /dev/null # We install the version from the official website which curl &> /dev/null || sudo apt update && sudo apt install curl -y # install curl if not already installed echo "deb [trusted=yes] http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list sudo apt update sudo apt install spotify-client -y echo -e "\nSpotify installed!" # We install the prerequisites to build and install the patch (Git and Rust will be installed and not removed) sudo apt install git make build-essential -y which rustc &> /dev/null || curl https://sh.rustup.rs -sSf | ( sh -s -- -y; source $HOME/.cargo/env ) # install rust if not already installed # Download and build the patch git clone https://github.com/abba23/spotify-adblock.git cd spotify-adblock make # Install the patch sudo make install # Removing sourcecode folder cd .. rm -rf spotify-adblock # We replace the Ubuntu desktop shortcut if needed if [ -f /usr/share/applications/spotify.desktop ] ; then sudo sed -i "7s#.*#Exec=env LD_PRELOAD=/usr/local/lib/spotify-adblock.so spotify %U#" /usr/share/applications/spotify.desktop fi echo -e "\nSpotify patched! 🎉"