main
1pkgname=g-helper-linux
2pkgver=1.0.87
3pkgrel=1
4pkgdesc="g-helper linux port"
5arch=('x86_64')
6license=('GPL-3.0-only')
7depends=('bash' 'hicolor-icon-theme')
8makedepends=('dotnet-sdk' 'clang' 'upx' 'libpipewire' 'pkg-config')
9source=("https://github.com/utajum/g-helper-linux/archive/refs/tags/v$pkgver.tar.gz")
10sha256sums=('2beb926a9e88413eac1f5851f254a4190cf25987b8bd1f3aaeeb30adbc6af97e')
11url="https://github.com/utajum/g-helper-linux"
12
13prepare() {
14 cd "${pkgname}-${pkgver}"
15 sed -i 's@/usr/local/lib/ghelper/@/usr/lib/ghelper/@g' ./install/ghelper-gpu-boot.service
16 echo -e "asus_nb_wmi\nasus_wmi" > ghelper.conf
17
18 SUDOERS_CONTENT="# G-Helper: passwordless access to the root-owned helper binaries
19ALL ALL=(root) NOPASSWD: /usr/lib/ghelper/gpu-block-helper.sh
20ALL ALL=(root) NOPASSWD: /usr/lib/ghelper/gpu-helper"
21
22 echo "$SUDOERS_CONTENT" > sudoers
23
24 sed -i 's@/usr/local/lib/ghelper/gpu-block-helper.sh@/usr/lib/ghelper/gpu-block-helper.sh@g' ./src/Install/Installer.cs
25 sed -i 's@/usr/local/lib/ghelper/ghelper-gpu-boot.sh@/usr/lib/ghelper/ghelper-gpu-boot.sh@g' ./src/Install/Installer.cs
26 sed -i 's@/etc/systemd/system/ghelper-gpu-boot.service@/usr/lib/systemd/system/ghelper-gpu-boot.service@g' ./src/Install/Installer.cs
27 sed -i 's@/etc/udev/rules.d/90-ghelper.rules@/usr/lib/udev/rules.d/90-ghelper.rules@g' ./src/Install/Installer.cs
28 sed -i 's@/etc/modules-load.d/ghelper.conf@/usr/lib/modules-load.d/ghelper.conf@g' ./src/Install/Installer.cs
29 sed -i 's@/etc/ghelper/gpu-helper@/usr/lib/ghelper/gpu-helper@g' ./src/Platform/Linux/SysfsHelper.cs
30 sed -i 's@/opt/ghelper/gpu-helper@/usr/lib/ghelper/gpu-helper@g' ./src/Platform/Linux/SysfsHelper.cs
31 sed -i 's@rm -f "\$GPU_HELPER_DIR/gpu-helper"@echo "Not deleting the needed artifacts."@' ./build.sh
32}
33
34build() {
35 cd "${pkgname}-${pkgver}"
36 ./build.sh
37}
38
39package() {
40 cd "${pkgname}-${pkgver}"
41 install -Dm755 "./dist/ghelper" "$pkgdir/usr/bin/ghelper"
42 install -Dm644 "./install/90-ghelper.rules" "$pkgdir/usr/lib/udev/rules.d/90-ghelper.rules"
43 install -Dm755 "./install/ghelper-gpu-boot.sh" "$pkgdir/usr/lib/ghelper/ghelper-gpu-boot.sh"
44 install -Dm755 "./install/gpu-block-helper.sh" "$pkgdir/usr/lib/ghelper/gpu-block-helper.sh"
45 install -Dm755 "./vendor/gpu-helper/gpu-helper" "$pkgdir/usr/lib/ghelper/gpu-helper"
46 install -Dm644 "./install/ghelper-gpu-boot.service" "$pkgdir/usr/lib/systemd/system/ghelper-gpu-boot.service"
47 install -Dm644 "./install/ghelper.desktop" "$pkgdir/usr/share/applications/ghelper.desktop"
48 install -Dm644 "./install/ghelper.png" "$pkgdir/usr/share/icons/hicolor/256x256/apps/ghelper.png"
49 install -Dm644 "./ghelper.conf" "$pkgdir/usr/lib/modules-load.d/ghelper.conf"
50 install -Dm0440 "./sudoers" "$pkgdir/etc/sudoers.d/ghelper-gpu"
51}
52