diff --git a/.SRCINFO b/.SRCINFO index 79e22334f941e..87e1b94a7d43f 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,11 +1,12 @@ pkgbase = crossmacro pkgdesc = Cross-platform mouse and keyboard macro automation tool - pkgver = 0.9.8 + pkgver = 0.9.9 pkgrel = 1 url = https://github.com/alper-han/CrossMacro install = crossmacro.install arch = x86_64 - license = GPL-3.0 + arch = aarch64 + license = GPL-3.0-only makedepends = dotnet-sdk>=10.0 makedepends = clang makedepends = zlib @@ -20,11 +21,12 @@ pkgbase = crossmacro depends = polkit depends = libxtst depends = systemd-libs + depends = libxkbcommon options = !strip - source = crossmacro-0.9.8.tar.gz::https://github.com/alper-han/CrossMacro/archive/v0.9.8.tar.gz + source = crossmacro-0.9.9.tar.gz::https://github.com/alper-han/CrossMacro/archive/v0.9.9.tar.gz source = crossmacro.sysusers source = crossmacro-modules.conf - sha256sums = a7d477ebd717350354ff20331a0597ba6788376a37eecc7ba9d9ab45c58a590d + sha256sums = 6db0655aa63b1d610d6b8e72655a1c5b87f001d7cd7b3f06ebbd0ff971ab0950 sha256sums = SKIP sha256sums = SKIP diff --git a/PKGBUILD b/PKGBUILD index f43fb99fdc9e8..5c41803c30b9d 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,32 +1,45 @@ # Maintainer: Zynix pkgname=crossmacro -pkgver=0.9.8 +pkgver=0.9.9 pkgrel=1 pkgdesc="Cross-platform mouse and keyboard macro automation tool" -arch=('x86_64') +arch=('x86_64' 'aarch64') url="https://github.com/alper-han/CrossMacro" -license=('GPL-3.0') -depends=('glibc' 'gcc-libs' 'zlib' 'openssl' 'fontconfig' 'libx11' 'libxcursor' 'libxrandr' 'polkit' 'libxtst' 'systemd-libs') +license=('GPL-3.0-only') +depends=('glibc' 'gcc-libs' 'zlib' 'openssl' 'fontconfig' 'libx11' 'libxcursor' 'libxrandr' 'polkit' 'libxtst' 'systemd-libs' 'libxkbcommon') makedepends=('dotnet-sdk>=10.0' 'clang' 'zlib') options=('!strip') -source=("${pkgname}-${pkgver}.tar.gz::https://github.com/alper-han/CrossMacro/archive/v0.9.8.tar.gz" +source=("${pkgname}-${pkgver}.tar.gz::https://github.com/alper-han/CrossMacro/archive/v0.9.9.tar.gz" "crossmacro.sysusers" "crossmacro-modules.conf") -sha256sums=('a7d477ebd717350354ff20331a0597ba6788376a37eecc7ba9d9ab45c58a590d' +sha256sums=('6db0655aa63b1d610d6b8e72655a1c5b87f001d7cd7b3f06ebbd0ff971ab0950' 'SKIP' 'SKIP') # sysusers and modules config checksums (local files) install=crossmacro.install build() { - cd "CrossMacro-0.9.8" + cd "CrossMacro-0.9.9" + local target_rid + case "${CARCH}" in + x86_64) + target_rid="linux-x64" + ;; + aarch64) + target_rid="linux-arm64" + ;; + *) + echo "Unsupported architecture: ${CARCH}" >&2 + return 1 + ;; + esac export DOTNET_SKIP_WORKLOAD_INTEGRITY_CHECK=1 - dotnet restore -r linux-x64 + dotnet restore -r "$target_rid" # Build UI dotnet publish src/CrossMacro.UI.Linux/CrossMacro.UI.Linux.csproj \ -c Release \ - -r linux-x64 \ + -r "$target_rid" \ --self-contained true \ -p:PublishSingleFile=true \ -p:PublishTrimmed=true \ @@ -39,12 +52,12 @@ build() { # Build Daemon dotnet publish src/CrossMacro.Daemon/CrossMacro.Daemon.csproj \ -c Release \ - -r linux-x64 \ + -r "$target_rid" \ -o publish-daemon/ } package() { - cd "CrossMacro-0.9.8" + cd "CrossMacro-0.9.9" # Install UI files install -dm755 "$pkgdir/usr/lib/$pkgname" diff --git a/crossmacro.install b/crossmacro.install index be1b5e89ce4c1..32a6d644da203 100644 --- a/crossmacro.install +++ b/crossmacro.install @@ -1,37 +1,108 @@ +_crossmacro_load_uinput() { + # Best effort: make uinput available immediately for the daemon. + # Persistent boot-time loading is handled by /usr/lib/modules-load.d/crossmacro.conf. + if command -v modprobe >/dev/null 2>&1; then + modprobe uinput >/dev/null 2>&1 || true + fi +} + +_crossmacro_has_cmd() { + command -v "$1" >/dev/null 2>&1 +} + +_crossmacro_has_systemd_runtime() { + [ -d /run/systemd/system ] && _crossmacro_has_cmd systemctl +} + +_crossmacro_reload_udev() { + if _crossmacro_has_cmd udevadm; then + udevadm control --reload-rules >/dev/null 2>&1 || true + udevadm settle >/dev/null 2>&1 || true + fi +} + post_install() { - echo "Reloading systemd daemon..." - systemctl daemon-reload - udevadm control --reload-rules && udevadm trigger || true + if _crossmacro_has_systemd_runtime; then + echo "Reloading systemd daemon..." + systemctl daemon-reload >/dev/null 2>&1 || true + fi + + _crossmacro_reload_udev + _crossmacro_load_uinput + if _crossmacro_has_cmd udevadm; then + udevadm trigger >/dev/null 2>&1 || true + udevadm settle >/dev/null 2>&1 || true + fi + + auto_service_status="systemd runtime not detected; skipped auto enable/start" + if _crossmacro_has_systemd_runtime; then + if systemctl enable --now crossmacro.service >/dev/null 2>&1; then + auto_service_status="crossmacro.service enabled and started automatically" + else + auto_service_status="auto enable/start failed; run: sudo systemctl enable --now crossmacro.service" + fi + fi + + installer_user="" + if [ -n "${SUDO_USER:-}" ] && [ "${SUDO_USER}" != "root" ]; then + installer_user="${SUDO_USER}" + elif [ -n "${PKEXEC_UID:-}" ] && [ "${PKEXEC_UID}" != "0" ]; then + installer_user="$(getent passwd "${PKEXEC_UID}" | cut -d: -f1)" + fi + + if [ -n "$installer_user" ] && getent passwd "$installer_user" >/dev/null 2>&1; then + usermod -aG crossmacro "$installer_user" >/dev/null 2>&1 || true + fi + echo "------------------------------------------------------------------------" echo "CrossMacro Daemon installed." + echo "Service: $auto_service_status" echo "" - echo "1. Enable and start the service:" - echo " sudo systemctl enable --now crossmacro.service" + if [ -n "$installer_user" ]; then + echo "1. '$installer_user' was added to 'crossmacro' group (best effort)." + echo " If needed, run: sudo usermod -aG crossmacro \$USER" + else + echo "1. Add yourself to the 'crossmacro' group to communicate with the daemon:" + echo " sudo usermod -aG crossmacro \$USER" + fi echo "" - echo "2. Add yourself to the 'crossmacro' group to communicate with the daemon:" - echo " sudo usermod -aG crossmacro \$USER" - echo "" - echo "3. Log out and log back in for group changes to take effect." + echo "2. Log out and log back in for group changes to take effect." echo "------------------------------------------------------------------------" } post_upgrade() { - systemctl daemon-reload + if _crossmacro_has_systemd_runtime; then + systemctl daemon-reload >/dev/null 2>&1 || true + fi + + _crossmacro_reload_udev + _crossmacro_load_uinput + if _crossmacro_has_cmd udevadm; then + udevadm trigger >/dev/null 2>&1 || true + udevadm settle >/dev/null 2>&1 || true + fi + # Only restart if service is active - if systemctl is-active --quiet crossmacro.service 2>/dev/null; then - systemctl try-restart crossmacro.service || true + if _crossmacro_has_systemd_runtime && systemctl is-active --quiet crossmacro.service 2>/dev/null; then + systemctl try-restart crossmacro.service >/dev/null 2>&1 || true fi } pre_remove() { + if ! _crossmacro_has_systemd_runtime; then + return 0 + fi + # Only disable if service exists and is enabled/active if systemctl is-enabled --quiet crossmacro.service 2>/dev/null || \ systemctl is-active --quiet crossmacro.service 2>/dev/null; then - systemctl disable --now crossmacro.service || true + systemctl disable --now crossmacro.service >/dev/null 2>&1 || true fi } post_remove() { - systemctl daemon-reload - udevadm control --reload-rules && udevadm trigger || true + if _crossmacro_has_systemd_runtime; then + systemctl daemon-reload >/dev/null 2>&1 || true + fi + _crossmacro_reload_udev } diff --git a/crossmacro.sysusers b/crossmacro.sysusers index 3c01e9dfa092a..7c0e2ce5cf7c6 100644 --- a/crossmacro.sysusers +++ b/crossmacro.sysusers @@ -1,3 +1,5 @@ g crossmacro - +g uinput - u crossmacro - "CrossMacro Daemon User" / /usr/bin/nologin m crossmacro input +m crossmacro uinput