Gentoo Archives: gentoo-commits

From: James Le Cuirot <chewi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-util/game-device-udev-rules/files/, games-util/game-device-udev-rules/
Date: Sat, 31 Oct 2020 21:57:16
Message-Id: 1604181413.d701134d275f0273076a897ad6df9429efc4d3bf.chewi@gentoo
1 commit: d701134d275f0273076a897ad6df9429efc4d3bf
2 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 31 21:56:53 2020 +0000
4 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 31 21:56:53 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d701134d
7
8 games-util/game-device-udev-rules: New package
9
10 Package-Manager: Portage-3.0.8, Repoman-3.0.1
11 Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
12
13 games-util/game-device-udev-rules/Manifest | 1 +
14 .../files/60-game-input-20201025.rules | 3 +
15 .../game-device-udev-rules-20201025.ebuild | 80 ++++++++++++++++++++++
16 games-util/game-device-udev-rules/metadata.xml | 12 ++++
17 4 files changed, 96 insertions(+)
18
19 diff --git a/games-util/game-device-udev-rules/Manifest b/games-util/game-device-udev-rules/Manifest
20 new file mode 100644
21 index 00000000000..bb0a4866ef7
22 --- /dev/null
23 +++ b/games-util/game-device-udev-rules/Manifest
24 @@ -0,0 +1 @@
25 +DIST steam-devices-46bd9ae69542577c0db44a4bd664585c03eaad9d.tar.gz 2104 BLAKE2B 82a62fbe12ed7474234376d2fc66b99985b828954a1c861db1ba03cb2d10344bdfc2c0c3755278b2a4e0086f5b4ddef211412316d1c7fc68beaffd42f9ace3d2 SHA512 55db08aa8f48d21b67ce7850b80629fd70761104b04e260188ff7e6c7267827e2756b7feed937a647711342616649fe638efe9f8b3a6f898a5c8dd557683d76f
26
27 diff --git a/games-util/game-device-udev-rules/files/60-game-input-20201025.rules b/games-util/game-device-udev-rules/files/60-game-input-20201025.rules
28 new file mode 100644
29 index 00000000000..04a6ce41f4a
30 --- /dev/null
31 +++ b/games-util/game-device-udev-rules/files/60-game-input-20201025.rules
32 @@ -0,0 +1,3 @@
33 +
34 +# Thrustmaster T-Wireless
35 +KERNEL=="hidraw*", ATTRS{idVendor}=="044f", ATTRS{idProduct}=="d007", TAG+="uaccess"
36
37 diff --git a/games-util/game-device-udev-rules/game-device-udev-rules-20201025.ebuild b/games-util/game-device-udev-rules/game-device-udev-rules-20201025.ebuild
38 new file mode 100644
39 index 00000000000..79f0a640125
40 --- /dev/null
41 +++ b/games-util/game-device-udev-rules/game-device-udev-rules-20201025.ebuild
42 @@ -0,0 +1,80 @@
43 +# Copyright 2020 Gentoo Authors
44 +# Distributed under the terms of the GNU General Public License v2
45 +
46 +EAPI=7
47 +
48 +inherit udev
49 +
50 +# Although this is mainly a tweaked version of Steam's udev rules, it
51 +# also has its own rules and more may be added later so we version it
52 +# independently.
53 +
54 +STEAM_COMMIT="46bd9ae69542577c0db44a4bd664585c03eaad9d"
55 +MY_P="steam-devices-${STEAM_COMMIT}"
56 +
57 +DESCRIPTION="udev rules for various game hardware devices"
58 +HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Games"
59 +SRC_URI="https://github.com/ValveSoftware/steam-devices/archive/${STEAM_COMMIT}.tar.gz -> ${MY_P}.tar.gz"
60 +LICENSE="MIT"
61 +SLOT="0"
62 +KEYWORDS="~amd64 ~arm ~x86"
63 +IUSE="+acl elogind systemd"
64 +REQUIRED_USE="acl? ( || ( elogind systemd ) )"
65 +
66 +RDEPEND="
67 + acl? (
68 + elogind? ( sys-auth/elogind[acl] )
69 + systemd? ( sys-apps/systemd[acl] )
70 + )
71 + !acl? (
72 + acct-group/input
73 + )
74 + virtual/udev
75 +"
76 +
77 +S="${WORKDIR}/${MY_P}"
78 +
79 +pkg_setup() {
80 + if ! use acl; then
81 + elog "Users of game hardware devices must be added to the input group."
82 +
83 + if use elogind || use systemd; then
84 + ewarn "It is highly recommended that you enable USE=acl on this package instead"
85 + ewarn "when using elogind or systemd as this is more secure and just works."
86 + fi
87 + fi
88 +}
89 +
90 +src_prepare() {
91 + default
92 +
93 + local SRC DEST EXTRA
94 + for SRC in 60-steam-{input,vr}.rules; do
95 + DEST=${SRC//steam/game}
96 + EXTRA=${FILESDIR}/${DEST/./-${PV}.}
97 +
98 + # Make changes in a copy.
99 + cp -v "${SRC}" "${DEST}" || die
100 +
101 + # Append our additional rules.
102 + if [[ -f ${EXTRA} ]]; then
103 + cat "${EXTRA}" >> "${DEST}" || die
104 + fi
105 +
106 + # Clear any existing mode settings.
107 + sed -i 's/, *MODE="[0-9]*"//' "${DEST}" || die
108 +
109 + if ! use acl; then
110 + # Replace uaccess tag with our group+mode if not using ACL.
111 + sed -i 's/, *TAG+="uaccess"/, GROUP="input", MODE="0660"/' "${DEST}" || die
112 + fi
113 + done
114 +}
115 +
116 +src_install() {
117 + udev_dorules 60-game-{input,vr}.rules
118 +}
119 +
120 +pkg_postinst() {
121 + udev_reload
122 +}
123
124 diff --git a/games-util/game-device-udev-rules/metadata.xml b/games-util/game-device-udev-rules/metadata.xml
125 new file mode 100644
126 index 00000000000..9a8e14a39d4
127 --- /dev/null
128 +++ b/games-util/game-device-udev-rules/metadata.xml
129 @@ -0,0 +1,12 @@
130 +<?xml version="1.0" encoding="UTF-8"?>
131 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
132 +<pkgmetadata>
133 + <maintainer type="person">
134 + <email>chewi@g.o</email>
135 + <name>James Le Cuirot</name>
136 + </maintainer>
137 + <maintainer type="project">
138 + <email>games@g.o</email>
139 + <name>Gentoo Games Project</name>
140 + </maintainer>
141 +</pkgmetadata>