# 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" }