#!/bin/sh # File: /usr/locla/bin/kvm-udev-trigger.sh # Location: vm2 # Author: bgstack15 # Startdate: 2023-01-11-4 11:39 # Title: Reaction script for Udev detecting kvm input # Project: kvm-mapping # Purpose: When triggered from udev, touch the file that the per-user daemon listens for # History: # Usage: # when run by udev rule, make file that per-user daemons watch for # Reference: # Improve: # Dependencies: # /etc/udev/rules.d/kvm-input.rules # ~bin/kvm-mapping-daemon.sh running in user session, from ~/.fluxbox/startup probably # logger # Dependencies: KVMFILE=/run/kvm/kvmfile KVMDIR="$( dirname "${KVMFILE}" )" test "${DEVTYPE}" = "usb_device" && { ! test -d "${KVMDIR}" && mkdir -p "${KVMDIR}" chmod 0777 "${KVMDIR}" echo "kvm input detected!" | logger --priority user.notice touch "${KVMFILE}" ; chmod 0666 "${KVMFILE}" }