summaryrefslogtreecommitdiff
path: root/build-support/extra/rust/watcher.sh
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2019-10-20 19:04:25 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2019-10-20 19:04:25 +0200
commit49b3e3291c93355792757f94af9774617ed3d7bf (patch)
treec861d0e4b26bfaff2ec36047dcb2d01f40491cfc /build-support/extra/rust/watcher.sh
parent25274d1a910f953b7aedadead0cf2e232208a513 (diff)
downloadpackages-49b3e3291c93355792757f94af9774617ed3d7bf.tar.xz
added some build-support for rust
Diffstat (limited to 'build-support/extra/rust/watcher.sh')
-rwxr-xr-xbuild-support/extra/rust/watcher.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/build-support/extra/rust/watcher.sh b/build-support/extra/rust/watcher.sh
new file mode 100755
index 00000000..544c3712
--- /dev/null
+++ b/build-support/extra/rust/watcher.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+term() {
+ echo "--> Got SIGTERM"
+ echo "--> killing inotifywait with PID $inotifywait"
+ kill -TERM "$inotifywait"
+}
+
+srcdir="$1"
+
+trap term SIGTERM
+
+inotifywait -mr -e close_write --format %w%f $srcdir | while read -r FILE; do
+ case "$FILE" in
+ *consts.rs)
+ echo "--> patching $FILE"
+ sed -i '/pub type U1024/d;/pub type P1024/d' $FILE
+ echo "--> finished patching $FILE"
+ ;;
+ esac
+done &
+inotifywait=$(ps -ef | grep inotifywait | grep -v grep | tr -s ' ' | cut -d ' ' -f2)
+echo "--> waiting for inotifywait $inotifywait"
+wait "$inotifywait"
+echo "--> watcher terminated"