Username: Password: Remember me
# Maintainer: Ashley Whetter <(firstname) @ awhetter.co.uk>
# Co-Maintainer: NicoHood <archlinux {cat} nicohood {dog} de>
# PGP ID: 97312D5EB9D7AE7D0BD4307351DAE9B7C1AE9161
# Contributor: Eothred <yngve.levinsen@gmail.com>
 
pkgname=spotify-bin
_pkgname=spotify
pkgver=1.1.5.153
_commit=gf614956d
_ver_x86_64=16
pkgrel=1
pkgdesc='A proprietary music streaming service.'
arch=('x86_64')
license=('custom')
url='https://www.spotify.com'
screenshot="https://res.cloudinary.com/canonical/image/fetch/q_auto,f_auto,w_860/https://dashboard.snapcraft.io/site_media/appmedia/2017/12/Screenshot_from_2017-12-18_12-07-06.png"
depends=('alsa-lib>=1.0.14' 'gconf' 'gtk2' 'glib2' 'nss' 'libsystemd' 'libxtst'
         'libx11' 'libxss' 'desktop-file-utils' 'rtmpdump' 'openssl-1.0')
depends=('libcurl-gnutls')
optdepends=('ffmpeg-compat-57: Adds support for playback of local files'
            'zenity: Adds support for importing local files'
            'libnotify: Desktop notifications')
provides=('spotify')
conflicts=('spotify')
replaces=('spotify')
options=('!strip')
source=('spotify.protocol'
        'LICENSE'
        "${_pkgname}-${pkgver}-Release::http://repository.spotify.com/dists/stable/Release"
        "${_pkgname}-${pkgver}-Release.sig::http://repository.spotify.com/dists/stable/Release.gpg"
        "${_pkgname}-${pkgver}-x86_64.deb::https://repository-origin.spotify.com/pool/non-free/s/spotify-client/spotify-client_${pkgver}.${_commit}-${_ver_x86_64}_amd64.deb"
        "${_pkgname}-${pkgver}-x86_64-Packages::http://repository.spotify.com/dists/stable/non-free/binary-amd64/Packages")
 
sha512sums=('999abe46766a4101e27477f5c9f69394a4bb5c097e2e048ec2c6cb93dfa1743eb436bde3768af6ba1b90eaac78ea8589d82e621f9cbe7d9ab3f41acee6e8ca20'
            '2e16f7c7b09e9ecefaa11ab38eb7a792c62ae6f33d95ab1ff46d68995316324d8c5287b0d9ce142d1cf15158e61f594e930260abb8155467af8bc25779960615'
            '037266fe6f78a06cf92c7564379dbde1a32624014ad630567860267568dddc7bc4caa5e88888f19a4aa089b154e88938965984baa7491d87554cd688a90eddef'
            'SKIP'
            'db354f161c35b5f1a2d633282fad8fccf565e0061e7d258012f28422d766630391d47d4dafe22448fb60f850bf4ccbfdf82443cf107e03727c077b2c62e524be'
            'a726ce2c61863429e5e2b8e624f94401bbb95ba54bbb266d23a15b0b7c2eb97ef2347b2446beeb0c222afab1dee6406edf719f228fe53e1aea2587eca2cdb8e1')
validpgpkeys=('931FF8E79F0876134EDDBDCCA87FF9DF48BF1C90') # Spotify <tux@spotify.com>
 
_SPOTIFY_ARCH=amd64
 
 
prepare() {
    # Validate hashes from the PGP signed "Release" file
    echo "$(grep non-free/binary-${_SPOTIFY_ARCH}/Packages ${_pkgname}-${pkgver}-Release | tail -n 2 | head -n 1 | awk '{print $1}') ${_pkgname}-${pkgver}-${CARCH}-Packages" \
        > "${_pkgname}-${pkgver}-${CARCH}-Packages.sha256"
    sha256sum -c "${_pkgname}-${pkgver}-${CARCH}-Packages.sha256"
 
    echo "$(grep SHA512 ${_pkgname}-${pkgver}-${CARCH}-Packages | head -n 1 | awk '{print $2}') ${_pkgname}-${pkgver}-${CARCH}.deb" \
        > "${_pkgname}-${pkgver}-${CARCH}.deb.sha512"
    sha512sum -c "${_pkgname}-${pkgver}-${CARCH}.deb.sha512"
}
 
package() {
 
    tar -xzf data.tar.gz -C "${pkgdir}"
 
    install -Dm644 "${pkgdir}"/usr/share/spotify/spotify.desktop "${pkgdir}"/usr/share/applications/spotify.desktop
    install -Dm644 "${pkgdir}"/usr/share/spotify/icons/spotify-linux-512.png "${pkgdir}"/usr/share/pixmaps/spotify-client.png
 
    for size in 22 24 32 48 64 128 256 512; do
        install -Dm644 "${pkgdir}/usr/share/spotify/icons/spotify-linux-$size.png" \
            "${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps/spotify.png"
    done
 
    # Move spotify binary to its proper location
    mkdir -p "${pkgdir}"/opt/spotify
    mv "${pkgdir}/usr/share/spotify" "${pkgdir}/opt/"
 
    # Symlink spotify binary which is located in /opt
    ln -sf /opt/spotify/spotify "${pkgdir}/usr/bin/spotify"
 
    # Copy protocol file for KDE
    install -Dm644 "${srcdir}/spotify.protocol" "${pkgdir}/usr/share/kservices5/spotify.protocol"
 
    # Install license
    # https://www.spotify.com/legal/end-user-agreement
    install -Dm 644 LICENSE "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
 
    # Fix permissions
    chmod -R go-w "${pkgdir}"
}