From 46cbcb5b4b999efc98a9c703758eca880ad56143 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Mon, 23 Mar 2026 15:28:18 +0545 Subject: [PATCH] update --- .gitignore | 3 +- PKGBUILD | 121 ++++++++++++++++++++++++++++++++++ src/commands/install_rules.rs | 4 +- 3 files changed, 124 insertions(+), 4 deletions(-) create mode 100644 PKGBUILD diff --git a/.gitignore b/.gitignore index 1a22800..11ecce8 100644 --- a/.gitignore +++ b/.gitignore @@ -24,5 +24,4 @@ target # Added by cargo /target -./lapctl.py -lapctl.py +./PKGBUILD diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..97725a6 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,121 @@ +# Maintainer: Sankalp Tharu +pkgname=lapctl +pkgver=0.3.0 +pkgrel=1 +pkgdesc="Control Linux laptop hardware (Graphics, Battery, Power, Cooling, Display) with Rust" +arch=('x86_64' 'aarch64') +url="https://github.com/S4NKALP/lapctl" +license=('MIT') +depends=('systemd-libs' 'dbus' 'wayland') +makedepends=('rust' 'cargo' 'wayland-protocols') +optdepends=( + 'xorg-xrandr: for GPU switching on X11' + 'nvidia-settings: for NVIDIA GPU management on X11' +) +source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/${pkgver}.tar.gz") +sha256sums=('fda8c8dd9a170cbd54b549a57194dc36f1cdff7387cb85f70d1c1ae55c315259') + +prepare() { + cd "${pkgname}-${pkgver}" + export RUSTUP_TOOLCHAIN=stable + cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')" +} + +build() { + cd "${pkgname}-${pkgver}" + export RUSTUP_TOOLCHAIN=stable + export CARGO_TARGET_DIR=target + cargo build --frozen --release --all-features +} + +check() { + cd "${pkgname}-${pkgver}" + export RUSTUP_TOOLCHAIN=stable + cargo test --frozen --all-features +} + +package() { + cd "${pkgname}-${pkgver}" + + # Binary + install -Dm755 "target/release/${pkgname}" "${pkgdir}/usr/bin/${pkgname}" + + # D-Bus Policy + install -Dm644 /dev/stdin "${pkgdir}/etc/dbus-1/system.d/org.lapctl.conf" < + + + + + + + + + + + + + + + +EOF + + # Systemd Service + install -Dm644 /dev/stdin "${pkgdir}/usr/lib/systemd/system/lapctld.service" < + + + lapctl + https://github.com/S4NKALP/lapctl + + Elevated execution for lapctl + Authentication is required to perform privileged lapctl operations + + auth_admin + auth_admin + yes + + /usr/bin/lapctl + false + + +EOF + + # Polkit Rules + install -Dm644 /dev/stdin "${pkgdir}/usr/share/polkit-1/rules.d/10-lapctl.rules" < lapctl https://github.com/S4NKALP/lapctl - + Elevated execution for lapctl Authentication is required to perform privileged lapctl operations @@ -89,7 +89,7 @@ pub fn execute() { create_file(rules_path, LAPCTL_UDEV_RULES, false); // Polkit fallbacks for rootless execution without the daemon - let polkit_policy_path = "/usr/share/polkit-1/actions/org.s4nkalp.lapctl.policy"; + let polkit_policy_path = "/usr/share/polkit-1/actions/org.lapctl.policy"; create_file(polkit_policy_path, POLKIT_POLICY, false); let polkit_rules_path = "/etc/polkit-1/rules.d/10-lapctl.rules";