summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1fa7ee4bc3068d6ca2c4415be12c1c220a42e5f9 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Maintainer: MrDuartePT <gonegrier.duarte@gmail.com>
# Maintainer: johnfanv2 <https://github.com/johnfanv2>


_pkgname=lenovolegionlinux
pkgname=${_pkgname}-git
pkgver=r255.45bcb86
pkgrel=1
pkgdesc="LenovoLegionLinux (LLL) brings additional drivers and tools for Lenovo Legion series laptops to Linux. PLEASE READ THE REPO BEFORE INSTALL THIS PACKAGE!!!"
arch=("x86_64")
url="https://github.com/johnfanv2/LenovoLegionLinux"
license=('GPL')

depends=(
  python-argcomplete
  python-yaml
  python-pyqt5
  polkit
  python-wheel
)
makedepends=(
  git
  python-build
  python-installer
  python-setuptools
)
optdepends=(
  "lenovolegionlinux-dkms-git: DKMS module"
)

conflicts=(
  legion-fan-utils-linux-git
)

source=("${_pkgname}::git+https://github.com/johnfanv2/LenovoLegionLinux")
sha256sums=('SKIP')

pkgver() {
  cd "${_pkgname}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}

prepare() {
  cd "${_pkgname}"
  pkgver_commit=$(echo $pkgver | cut -c 6-)
  git checkout $pkgver_commit
}

build() {
 cd "${srcdir}/${_pkgname}/python/legion_linux"
 python -m build --wheel --no-isolation
	
}
package() {
  mkdir -p ${pkgdir}/usr/share/{applications/,icons/,polkit-1/actions/}
  mkdir -p ${pkgdir}/usr/{local/bin,bin/,share/legion_linux}
  mkdir -p ${pkgdir}/etc/systemd/system
  mkdir -p ${pkgdir}/etc/acpi/{events,actions}

  cd "${srcdir}/${_pkgname}/python/legion_linux"
  python -m installer --destdir="$pkgdir" dist/*.whl
  cd "legion_linux"
  install -Dm644 legion_logo.png "${pkgdir}/usr/share/pixmaps/legion_logo.png"

#Custom files also use in gentoo (fix root gui application and desktop file)
  mkdir -p files && cd files
  wget https://raw.githubusercontent.com/MrDuartePT/mrduarte-ebuilds/master/sys-firmware/lenovolegionlinux/files/legion_cli.policy
  wget https://raw.githubusercontent.com/MrDuartePT/mrduarte-ebuilds/master/sys-firmware/lenovolegionlinux/files/legion_gui.desktop

#Install custom files
  install -Dm644 legion_cli.policy "${pkgdir}/usr/share/polkit-1/actions/"
  install -Dm775 legion_gui.desktop "${pkgdir}/usr/share/applications/"

# Systemd service
  cd "${srcdir}/${_pkgname}/extra"
  install -Dm664 service/*.service "${pkgdir}/etc/systemd/system" 
	install -Dm664 service/*.path "${pkgdir}/etc/systemd/system"
  install -Dm664 service/profiles/* "${pkgdir}/usr/share/legion_linux/"
  install -Dm664 service/profiles/* "${pkgdir}/usr/share/legion_linux/"
	
# ACPI service
  install -Dm775 acpi/actions/battery-legion-quiet.sh "${pkgdir}/etc/acpi/actions/"
  install -Dm664 acpi/events/ac_adapter_legion-fancurve "${pkgdir}/etc/acpi/events/"
}