blob: 3fc59b7a572ac6794a9ccb645d7865c53079e9be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# This install script is based on the installation/systemuser/install.sh script from moltengamepad
post_install() {
if [ -z "`grep "^gamepad:" /etc/group`" ]; then
groupadd gamepad
fi
if [ -n "`grep "^gamepad:" /etc/passwd`" ]; then
useradd -r -s /bin/false -c "gamepad user" gamepad
gpasswd -a gamepad gamepad
fi
udevadm control --reload
systemd-tmpfiles --create
# Reload uinput to get its new permissions.
rmmod uinput
modprobe uinput
# Try to detect a case where "TAG-=uaccess" is not supported.
# This work-around uses "last_rule" which can lead to surprising behavior when writing other udev rules.
# As a courtesy, alert the user in case they have interest in writing udev rules later.
UDEV_VERSION=$(udevadm --version)
if [[ "$?" -ne "0" ]]; then
UDEV_VERSION=""
echo "Could not detect udev version. If the version is less than 217, the uaccess tag cannot be removed."
fi
if [[ "$UDEV_VERSION" != "" && "$UDEV_VERSION" -ge "217" ]]; then
echo "Detected version of udev that supports removing tags."
echo ""
fi
if [[ "$UDEV_VERSION" != "" && "$UDEV_VERSION" -lt "217" ]]; then
echo "An old version of udev was detected! This version does not support removing the uaccess tag."
echo ""
fi
if [[ "$UDEV_VERSION" == "" || "$UDEV_VERSION" -lt "217" ]]; then
echo "If the uaccess tag is not removed, then hiding the original device nodes may fail in certain situations."
echo "To remedy this, please comment out the following line in /lib/udev/rules.d/70-uaccess.rules"
echo -e '\tSUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="uaccess"'
echo ""
echo "A modified version can be placed at /etc/udev/rules.d/70-uaccess.rules to shadow the original file in /lib/."
echo ""
fi
# Tell the user we're done and what to do next.
echo "Start/enable the moltengamepad service"
}
|