summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: eac71279a17a2422264a138819d04709f118fdea (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
62
63
64
65
# Maintainer: Mark Wagie <mark dot wagie at proton dot me>
pkgname=grub-reboot-picker
_app_id=com.mendhak.grubrebootpicker
pkgver=0.0.9
pkgrel=2
pkgdesc="Tray application to reboot into different OSes or UEFI/BIOS"
arch=('any')
url="https://github.com/mendhak/grub-reboot-picker"
license=('MIT')
depends=(
  'grub'
  'gtk3'
  'libappindicator-gtk3'
  'polkit'
  'python-cairo'
  'python-gobject'
  'systemd-sysvcompat'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz"
        'setup.patch'
        'un-reboot.png')  # from Ubuntu update-notifier package
sha256sums=('bb2fa24350fc72960dc8955ce7604d42110440eab89216948fee5a2677f86897'
            '53697a6925981cf83c3c67fed1646fff9a3800ce43994f7da94526151b285bb2'
            'd764a1b0722752b5166529838f29cfa5b708554d209fc4206e8f7f846e8a51cf')

prepare() {
  cd "$pkgname-$pkgver"

  # We don't need stdeb
  patch --verbose -p0 < "$srcdir/setup.patch"

  # sbin to bin
  for f in "${_app_id}.desktop" "${_app_id}.policy"; do
    sed -i 's/sbin/bin/g' "${f}"
  done

  if [[ -d "$pkgname" ]]; then
    rm -rf "$pkgname"
  fi
  mv src "$pkgname"
}

build() {
  cd "$pkgname-$pkgver"
  python -m build --wheel --no-isolation
}

package() {
  cd "$pkgname-$pkgver"
  python -m installer --destdir="$pkgdir" dist/*.whl

  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  mv -v "${pkgdir}${site_packages}"/etc "$pkgdir/"
  cp -rv "${pkgdir}${site_packages}"/usr/* "$pkgdir/usr/"
  rm -rfv "${pkgdir}${site_packages}/usr"

  install -Dm644 LICENSE.md -t "$pkgdir/usr/share/licenses/$pkgname"
  install -Dm644 "$srcdir/un-reboot.png" -t "$pkgdir/usr/share/icons/hicolor/48x48/apps/"
}