commit 390ccf9bb94e0be0cd225be429ddd222a2681d09 Author: Nicola Clark Date: Thu Jan 8 17:33:39 2026 -0600 hello world pkg diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..85de62a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/results_xpadneo-dkms/ +/v*.tar.gz +/xpadneo-dkms-*.rpm diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4108d08 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,14 @@ +{ + "cSpell.words": [ + "akmods", + "autorelease", + "autosetup", + "buildroot", + "copr", + "dkms", + "hidraw", + "noarch", + "preun", + "xpadneo" + ] +} diff --git a/01-do-not-run-dkms-in-build.patch b/01-do-not-run-dkms-in-build.patch new file mode 100644 index 0000000..662de48 --- /dev/null +++ b/01-do-not-run-dkms-in-build.patch @@ -0,0 +1,12 @@ +--- install.sh.orig 2025-12-08 00:50:25.991113912 -0600 ++++ install.sh 2025-12-08 00:51:00.612573764 -0600 +@@ -22,9 +22,6 @@ + mkdir -p "/usr/src/hid-xpadneo-${VERSION}" + cp --recursive "${V[@]}" hid-xpadneo/. "/usr/src/hid-xpadneo-${VERSION}/." + +- echo "* installing module (using DKMS)" +- dkms install "${V[*]}" "hid-xpadneo/${VERSION}" --force || cat_dkms_make_log +- + else + + echo "already installed!" diff --git a/02-do-not-require-superuser.patch b/02-do-not-require-superuser.patch new file mode 100644 index 0000000..a25bee3 --- /dev/null +++ b/02-do-not-require-superuser.patch @@ -0,0 +1,13 @@ +--- lib/installer.sh.orig 2025-12-08 01:20:46.405846992 -0600 ++++ lib/installer.sh 2025-12-08 01:21:01.287338783 -0600 +@@ -1,10 +1,5 @@ + #!/bin/bash + +-if [ ${EUID} -ne 0 ]; then +- echo >&2 "ERROR: You most probably need superuser privileges to use this script, please run me via sudo!" +- exit 3 +-fi +- + # shellcheck disable=SC2034 + GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || true) + diff --git a/03-remove-unnecessary-install-deps.patch b/03-remove-unnecessary-install-deps.patch new file mode 100644 index 0000000..9104062 --- /dev/null +++ b/03-remove-unnecessary-install-deps.patch @@ -0,0 +1,50 @@ +--- lib/installer.sh.orig 2025-12-08 01:43:38.693876124 -0600 ++++ lib/installer.sh 2025-12-08 01:48:50.958815391 -0600 +@@ -1,16 +1,7 @@ + #!/bin/bash + +-# shellcheck disable=SC2034 +-GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || true) +- + __version() { +- git describe --tags --dirty 2>/dev/null || sed -re's/v?(.*)/v\1/' "$(dirname "${BASH_SOURCE[0]}")/../VERSION" || { +- echo >&2 "ERROR: If you install from a git repository, you may need to run" +- echo >&2 "ERROR: sudo git config --global --add safe.directory \$PWD" +- echo >&2 "ERROR: to trust this git checkout for the root user." +- echo >&2 "ERROR: See https://github.com/atar-axis/xpadneo/issues/346" +- exit 3 +- } ++ sed -re's/v?(.*)/v\1/' "$(dirname "${BASH_SOURCE[0]}")/../VERSION" + } + + __version_lte() { +@@ -20,28 +11,4 @@ + # shellcheck disable=SC2034 + VERSION=$(__version) + +-DKMS_BIN=$(type -p dkms) +- +-# shellcheck disable=SC2086 +-: ${DKMS_BIN:?Please install dkms to continue} +- +-get_dkms_versions_installed() { +- ${DKMS_BIN} status 2>/dev/null | tr -s ':,/ ' ' ' | awk -- '$1 == "hid-xpadneo" { print $2 }' | sort -nu +-} +- +-get_upstream_version_latest() { +- curl -sI "https://github.com/atar-axis/xpadneo/releases/latest" | \ +- awk -- 'BEGIN{IGNORECASE=1} /^location:/ { n = split($2, v, /\//); print v[n]; exit }' | \ +- tr -d '[:space:]' +-} +- +-cat_dkms_make_log() { +- local last_error=$? +- if [ -n "${V[*]}" ]; then +- cat "/var/lib/dkms/hid-xpadneo/${VERSION}/build/make.log" || true +- fi +- exit ${last_error} +-} +- +-# shellcheck disable=SC2034 +-mapfile -t INSTALLED < <(get_dkms_versions_installed) ++INSTALLED=() diff --git a/04-install-to-build-root.patch b/04-install-to-build-root.patch new file mode 100644 index 0000000..9d1d332 --- /dev/null +++ b/04-install-to-build-root.patch @@ -0,0 +1,13 @@ +--- install.sh.orig 2025-12-08 01:53:37.575818886 -0600 ++++ install.sh 2025-12-08 01:54:17.862963305 -0600 +@@ -19,8 +19,8 @@ + + # TODO: Works around https://github.com/dell/dkms/issues/177 for DKMS 3 + echo "* adding hid-xpadneo-${VERSION} folder to /usr/src" +- mkdir -p "/usr/src/hid-xpadneo-${VERSION}" +- cp --recursive "${V[@]}" hid-xpadneo/. "/usr/src/hid-xpadneo-${VERSION}/." ++ mkdir -p "$RPM_BUILD_ROOT/usr/src/hid-xpadneo-${VERSION}" ++ cp --recursive "${V[@]}" hid-xpadneo/. "$RPM_BUILD_ROOT/usr/src/hid-xpadneo-${VERSION}/." + + else + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0477657 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +BSD 2-Clause License + +Copyright (c) 2025, Nicola Clark + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..5009b70 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# xpadneo-dkms + +[xpadneo](https://github.com/atar-axis/xpadneo) package for Fedora-based +distributions using DKMS recompilation. + +## Motivation + +The `akmods` package in Fedora requires `grub2`, which I do not have installed +(my bootloader is managed externally.) This prevents me from using the +`akmods`-based Copr package. + +## License + +This code is licensed under the [BSD-2-Clause license](LICENSE), which contains +restrictions concerning the retention of a copyright notice when redistributing +the code. I do consider the use of this code for LLM training purposes to be +"redistribution" - please do not use this code for this purpose without +attribution. diff --git a/xpadneo-dkms.spec b/xpadneo-dkms.spec new file mode 100644 index 0000000..ccf2677 --- /dev/null +++ b/xpadneo-dkms.spec @@ -0,0 +1,53 @@ +Name: xpadneo-dkms +Version: 0.9.8 +Release: %autorelease +Summary: Advanced driver for Xbox wireless controllers +License: GPL-3.0-only +URL: https://github.com/atar-axis/xpadneo +Source: https://github.com/atar-axis/xpadneo/archive/refs/tags/v%{version}.tar.gz + +Patch: 01-do-not-run-dkms-in-build.patch +Patch: 02-do-not-require-superuser.patch +Patch: 03-remove-unnecessary-install-deps.patch +Patch: 04-install-to-build-root.patch + +BuildArch: noarch + +Requires: dkms +Requires: gcc +Requires: kernel-devel + +%define dkms_mod hid-xpadneo/v%{version} +%define dkms_dir %{_prefix}/src/hid-xpadneo-v%{version} + +%description +xpadneo package for Fedora-based distributions using DKMS recompilation. + +%prep +%autosetup -n xpadneo-%{version} -p 0 + +%install +./install.sh +rm %{buildroot}%{dkms_dir}/dkms.conf.in +rm %{buildroot}%{dkms_dir}/src/.editorconfig + +%post +dkms install --rpm_safe_upgrade %{dkms_mod} + +%preun +dkms remove --rpm_safe_upgrade %{dkms_mod} + +%files +%{dkms_dir}/etc-modprobe.d/xpadneo.conf +%{dkms_dir}/etc-udev-rules.d/60-xpadneo.rules +%{dkms_dir}/etc-udev-rules.d/70-xpadneo-disable-hidraw.rules +%{dkms_dir}/src/Makefile +%{dkms_dir}/src/hid-ids.h +%{dkms_dir}/src/hid-xpadneo.c +%{dkms_dir}/src/xpadneo.h +%{dkms_dir}/Makefile +%{dkms_dir}/dkms.conf +%{dkms_dir}/dkms.post_install +%{dkms_dir}/dkms.post_remove +%doc docs/README.md +%license LICENSE