When developing Butane/Ignition files, I frequently forget to update the parent files after making a change to an included file. This causes a lot of wasted time re-provisioning, only to discover that my change did not take effect. To alleviate this, we'll use `make` with some macro magic to scan the Butane files for their dependencies, and let it generate whatever Ignition files need updating any time a dependant file changes. I've also added a "publish" step to the Makefile, since I also frequently forget to upload the regenerated Ignition files to the server, causing the same headaches.
11 lines
264 B
Bash
11 lines
264 B
Bash
#!/bin/sh
|
|
# vim: set sw=4 ts=4 sts=4 et :
|
|
|
|
inotifywait -e CLOSE_WRITE -m . \
|
|
| stdbuf -o 0 grep -v .ign \
|
|
| while read _ _ f; do
|
|
[ -f "${f}" ] || continue
|
|
printf '%s changed, running make ...\n' "${f}"
|
|
make && make publish
|
|
done
|