aboutsummaryrefslogtreecommitdiff
path: root/kvm-udev-trigger.sh
blob: af7e84bf484e0dbe97fc8bb8dab5458b934ced4b (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
#!/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}"
}
bgstack15