aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-07-13 16:17:40 -0300
committerSilvio Rhatto <rhatto@riseup.net>2024-07-13 16:17:40 -0300
commitc0bf4dd72275e11eb63068391ce9b393fbbc4906 (patch)
tree406aac0a2b38b96ca3d2ddc0ef28b0e72e27dfd1
parent0b350170865132b6843a10a55d304c7a5839d0c7 (diff)
downloadtemplates-c0bf4dd72275e11eb63068391ce9b393fbbc4906.tar.gz
templates-c0bf4dd72275e11eb63068391ce9b393fbbc4906.tar.bz2
Refactor watch script to support 'kvmx inotify' and arbitrary guest VMs
-rw-r--r--.gitignore1
-rwxr-xr-xscripts/watch25
2 files changed, 21 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 05d02cc..3d268f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ _static/templates.epub
_static/templates.pdf
site
.cache
+.env
diff --git a/scripts/watch b/scripts/watch
index b0b3c50..a5aa653 100755
--- a/scripts/watch
+++ b/scripts/watch
@@ -9,11 +9,26 @@ DIRNAME="$(cd `dirname $0` &> /dev/null && pwd)"
BASEDIR="$DIRNAME/.."
WATCHED="docs"
-# Got to the base folder
+# Load existing .env file
+if [ -e "$BASEDIR/.env" ]; then
+ source $BASEDIR/.env
+fi
+
+# Configuration
+FOLDER="${FOLDER:-/srv/shared}"
+VM="${VM:-}"
+
+# Got to the base folder, to make sure an empty VM
+# would resolve to the local kvmxfile
cd $BASEDIR
+# Built-in implementation
+#
# Dispatch
-while inotifywait -r $WATCHED; do
- #mkdocs build
- kvmx ssh make -C /srv/shared compile
-done
+#while inotifywait -r $WATCHED; do
+# #mkdocs build
+# kvmx ssh $VM make -C $FOLDER compile
+#done
+
+# Setup watcher
+kvmx inotify $VM $WATCHED make -C $FOLDER compile