diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2024-07-13 16:18:44 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2024-07-13 16:18:44 -0300 |
commit | 2f34c21c9f187240a3f9b76654daf6cb638efa00 (patch) | |
tree | 596d8d52bd92e723ff00949618304c91df71e50a | |
parent | da0aa7db0a02e0ca1319ff85b9bea300d188aaa3 (diff) | |
download | kvmx-2f34c21c9f187240a3f9b76654daf6cb638efa00.tar.gz kvmx-2f34c21c9f187240a3f9b76654daf6cb638efa00.tar.bz2 |
Feat: inotify action
-rw-r--r-- | ChangeLog.md | 5 | ||||
-rw-r--r-- | IDEAS.md | 6 | ||||
-rwxr-xr-x | kvmx | 26 |
3 files changed, 34 insertions, 3 deletions
diff --git a/ChangeLog.md b/ChangeLog.md index f8f520c..7a0c8a4 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,10 @@ # ChangeLog +## 0.3.0 - unreleased + +* Inotify action for watching a folder in the host and issuing commands in the + guest upon change. + ## 0.2.0 - 2024-07-02 * Increase default `msize` for 9p mounts to 32MiB depending on kernel support, @@ -2,13 +2,13 @@ ## Usability +* Submit patch for spice-client-gtk for menuless windows (spice usecase) to + Debian. + * Docs (tutorial and manpage). * Makefile and debian package. -* Submit patch for spice-client-gtk for menuless windows (spicec usecase) to - Debian. - * Systemd service for a single VM. * Shell completions. @@ -2562,6 +2562,32 @@ function kvmx_growpart { kvmx_restart } +# Inotify dispatcher +function kvmx_inotify { + local watched="$1" + + shift + local command="$*" + + # Syntax check + if [ -z "$command" ]; then + echo "usage $BASENAME inotify $GUEST <watched> <command>" + echo "example: kvmx inotify $guest hostfolder make -C guestfolder compile" + exit 1 + fi + + # Check if watched exists + if [ ! -e "$watched" ]; then + echo "Not found: $watched" + exit 1 + fi + + # Dispatch + while inotifywait -r $watched; do + echo "$command" | kvmx_ssh + done +} + # Dispatch if type kvmx_$ACTION 2> /dev/null | grep -q "kvmx_$ACTION ()"; then __kvmx_initialize $* |