#!/usr/bin/sh
# udev rule installer
# Provides access to /dev/input/event*
# Needs to be executed as root

set -e

# The rule file is always a sibling, both under /opt/drovio and in the source tree
install -m 644 -o root -g root "$(dirname "$0")/72-input-uaccess.rules" /usr/lib/udev/rules.d/

udevadm control --reload-rules
# --settle so we only return once logind has actually applied the ACLs: the caller
# re-probes /dev/input right after us, and an async trigger would still be in flight
udevadm trigger --settle --subsystem-match=input --action=add
