mig/tools/inotify_make.sh

96 строки
2.7 KiB
Bash
Исходник Обычный вид История

#!/bin/bash
# Julien Vehent - 2014
# watch the MIG source code directory and rebuild the components
# when a file is saved.
2014-02-24 21:00:43 +04:00
echo "starting inotify listener on ./src/mig"
# feed the inotify events into a while loop that creates
# the variables 'date' 'time' 'dir' 'file' and 'event'
inotifywait -mr --timefmt '%d/%m/%y %H:%M' --format '%T %w %f %e' \
2014-02-24 21:00:43 +04:00
-e modify ./src/mig \
| while read date time dir file event
do
if [[ "$file" =~ \.go$ && "$dir" =~ src\/mig ]]; then
dontskip=true
else
#echo skipping $date $time $event $dir $file
continue
fi
#echo NEW EVENT: $event $dir $file
if [[ "$dir" =~ src\/mig\/$ ]]; then
2014-08-13 20:25:30 +04:00
echo
make mig-agent && \
make mig-cmd && \
make mig-api && \
2014-03-26 22:57:24 +04:00
make mig-scheduler && \
echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ agent && "$file" != "configuration.go" ]] ; then
2014-08-13 20:25:30 +04:00
echo
make mig-agent && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ modules && "$file" != "configuration.go" ]] ; then
echo
2014-03-26 22:57:24 +04:00
make mig-agent && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ api ]] ; then
2014-08-13 20:25:30 +04:00
echo
2014-03-26 22:57:24 +04:00
make mig-api && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ client\/generator ]] ; then
2014-08-13 20:25:30 +04:00
echo
2014-03-26 22:57:24 +04:00
make mig-action-generator && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ client\/verifier ]] ; then
2014-08-13 20:25:30 +04:00
echo
2014-03-26 22:57:24 +04:00
make mig-action-verifier && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ client\/console ]] ; then
echo
make mig-console && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ client\/cmd ]] ; then
2014-11-07 07:14:14 +03:00
echo
make mig-console && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ client ]] ; then
echo
make mig-console && \
make mig-cmd && \
echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ workers ]] ; then
echo
make worker-agent-verif && \
make worker-agent-intel && \
echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ workers\/agent_intel ]] ; then
echo
make worker-agent-intel && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ workers\/agent_verif ]] ; then
echo
make worker-agent-verif && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ workers\/compliance_item ]] ; then
echo
make worker-compliance-item && echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ pgp ]] ; then
2014-08-13 20:25:30 +04:00
echo
make mig-agent && \
make mig-cmd && \
2014-03-26 22:57:24 +04:00
make mig-api && \
make mig-scheduler && \
2014-03-26 22:57:24 +04:00
echo success $(date +%H:%M:%S)
elif [[ "$dir" =~ scheduler ]] ; then
2014-08-13 20:25:30 +04:00
echo
2014-03-26 22:57:24 +04:00
make mig-scheduler && echo success $(date +%H:%M:%S)
fi
done