summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3184e012a35f879f0503266af285750e37ac594b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Maintainer:  Christopher Reimer <mail at c-reimer dot de>

pkgname=spotify-edge-snap
pkgver=1.1.67.586.gbb5ef64e
_snapid=pOBIoZ2LrCB3rDohMxoYGnbN14EHOgD7
_revision=50
pkgrel=1
pkgdesc='A proprietary music streaming service'
arch=('x86_64')
conflicts=('spotify')
provides=('spotify')
license=('custom')
url='https://www.spotify.com'
depends=('gtk3' 'libcurl-gnutls' 'libsm' 'nss')
makedepends=('squashfs-tools')
source=('spotify.protocol'
        'LICENSE')
# Get latest version info: curl -H 'Snap-Device-Series: 16' http://api.snapcraft.io/v2/snaps/info/spotify
source_x86_64=("https://api.snapcraft.io/api/v1/snaps/download/${_snapid}_${_revision}.snap")
sha512sums=('999abe46766a4101e27477f5c9f69394a4bb5c097e2e048ec2c6cb93dfa1743eb436bde3768af6ba1b90eaac78ea8589d82e621f9cbe7d9ab3f41acee6e8ca20'
            '2e16f7c7b09e9ecefaa11ab38eb7a792c62ae6f33d95ab1ff46d68995316324d8c5287b0d9ce142d1cf15158e61f594e930260abb8155467af8bc25779960615')
sha512sums_x86_64=('f29aa4a3f3d6a72f108f350905789f12ab3ae50cf4f4828f021d3be7759b192506c9a397e45309a5ee659578b6e85de80d7d78f994af9ab631c9fb2dc527c242')

prepare() {
    cd "${srcdir}"
    unsquashfs ${_snapid}_${_revision}.snap
}

package() {
    cd "${srcdir}"

    mkdir -p "${pkgdir}/opt"
    cp -a squashfs-root/usr/share/spotify "${pkgdir}/opt"

    install -Dm644 "${pkgdir}"/opt/spotify/spotify.desktop "${pkgdir}"/usr/share/applications/spotify.desktop
    sed -i 's/\/usr\/share\/spotify\/icons\/spotify-linux-128.png/spotify/' "${pkgdir}"/usr/share/applications/spotify.desktop

    for size in 22 24 32 48 64 128 256 512; do
        install -Dm644 "${pkgdir}/opt/spotify/icons/spotify-linux-$size.png" \
            "${pkgdir}/usr/share/icons/hicolor/${size}x${size}/apps/spotify.png"
    done

    # Symlink spotify binary which is located in /opt
    mkdir -p "${pkgdir}/usr/bin"
    ln -sf /opt/spotify/spotify "${pkgdir}/usr/bin/spotify"

    # Remove unneeded files
    rm -r "${pkgdir}/opt/spotify/apt-keys"
    rm -r "${pkgdir}/opt/spotify/icons"
    rm "${pkgdir}/opt/spotify/spotify.desktop"

    # 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}"
}