diff options
Diffstat (limited to 'kvm-udev-trigger.sh')
-rwxr-xr-x | kvm-udev-trigger.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/kvm-udev-trigger.sh b/kvm-udev-trigger.sh new file mode 100755 index 0000000..af7e84b --- /dev/null +++ b/kvm-udev-trigger.sh @@ -0,0 +1,26 @@ +#!/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}" +} |