summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 45730ed697d0a928cfe376f26ac23c22990accee (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
# Maintainer: XZS <d dot f dot fischer at web dot de>
# Contributor: FadeMind <fademind@gmail.com>

pkgname=aurora-themes
pkgver=3.20.20160705
pkgrel=1
pkgdesc='Easy On The Eyes GNOME Shell, GTK2, GTK3 and Cinnamon themes'
arch=('any')
url='https://www.opendesktop.org/p/1143475'
license=('GPL3')
makedepends=('jq')
optdepends=('gtk-engine-murrine: for GTK2 themes')
source=("meta::meta://dl.opendesktop.org/api/files/index?format=json&status=active&collection_content_id=${url##*/}"
        'https://dl.opendesktop.org/api/files/download/id/1468995652/Dark-Aurora.tar.gz')
sha256sums=('0f20c0287933ea77e0830d856ff75d6e99c80cf3ba185bda5fd6a662bae049b4'
            '6fbdaaae2e59b5f514ca003ba2552fcb7eb5724bd278e291ed5ae2036563d6ff')

# The following is a very convoluted script because of makepkg's DLAGENTS escaping logic.
# An agent is added for the protocol "meta". It is treated like http, which is done by processing
# the input url %u with sed, replacing the protocol back to http. Everything downloaded is then not
# immediatley saved to the output file name %o, but first piped through jq, which simplifies the
# JSON metadata received from the Dark Aurora page on GNOME-Look.org. This makes it more accessible
# for the following functions which then do not need to repeat the prefix again and again.
DLAGENTS=("meta::/usr/bin/bash -c $(
  printf '%s\n' "${DLAGENTS[@]}" | sed -n 's/http::\(.*\)/\1/p' \
    | sed 's/-[^ ] %o //' | sed 's/ /\\ /g' | sed 's/%u/$(echo\\ \"%u\"\\ |\\ sed\\ "s\/^meta\/http\/")/'
)\ |\ jq\ -j\ '.files.\"0\"'\ |\ sed\ '/downloaded/d'\ >\ %o"
"${DLAGENTS[@]}")

pkgver() {
  js -j '.version' meta
  while read -rd $'\0'
  do
    if [[ "$REPLY" -gt "$max" ]]
    then
      max="$REPLY"
    fi
  done < <(find */ -type f -exec stat --printf="%Y\0" '{}' +)
  date -d "@$max" +.%Y%m%d
}

package() {
  extend-optdepends
  install -d ${pkgdir}/usr/share/themes
  cp --no-preserve=mode -r ${srcdir}/*/ ${pkgdir}/usr/share/themes
} 

# Hidden in a subfunction not to show up in the .SRCINFO.
extend-optdepends() {
  optdepends+=("gnome-shell=$(jq -j .version meta): for gnome-shell themes")
}