2014-02-24 09:45:54 +04:00
|
|
|
#!/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"
|
2014-02-24 09:45:54 +04:00
|
|
|
# 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 \
|
2014-02-24 09:45:54 +04:00
|
|
|
| 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
|
2014-02-24 09:45:54 +04:00
|
|
|
make mig-agent && \
|
2015-08-23 04:44:02 +03:00
|
|
|
make mig-cmd && \
|
2014-02-24 09:45:54 +04:00
|
|
|
make mig-api && \
|
2014-03-26 22:57:24 +04:00
|
|
|
make mig-scheduler && \
|
|
|
|
echo success $(date +%H:%M:%S)
|
2014-02-24 09:45:54 +04:00
|
|
|
|
|
|
|
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)
|
2014-02-24 09:45:54 +04:00
|
|
|
|
|
|
|
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)
|
2014-02-24 09:45:54 +04:00
|
|
|
|
2015-08-23 04:44:02 +03:00
|
|
|
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)
|
2014-02-24 09:45:54 +04:00
|
|
|
|
2015-08-23 04:44:02 +03:00
|
|
|
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)
|
2014-02-24 09:45:54 +04:00
|
|
|
|
2015-08-23 04:44:02 +03:00
|
|
|
elif [[ "$dir" =~ client\/console ]] ; then
|
2014-08-21 17:32:28 +04:00
|
|
|
echo
|
|
|
|
make mig-console && echo success $(date +%H:%M:%S)
|
|
|
|
|
2015-08-23 04:44:02 +03:00
|
|
|
elif [[ "$dir" =~ client\/cmd ]] ; then
|
2014-11-07 07:14:14 +03:00
|
|
|
echo
|
|
|
|
make mig-console && echo success $(date +%H:%M:%S)
|
|
|
|
|
2015-08-23 04:44:02 +03:00
|
|
|
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)
|
|
|
|
|
2014-02-24 09:45:54 +04:00
|
|
|
elif [[ "$dir" =~ pgp ]] ; then
|
2014-08-13 20:25:30 +04:00
|
|
|
echo
|
2014-02-24 09:45:54 +04:00
|
|
|
make mig-agent && \
|
2015-08-23 04:44:02 +03:00
|
|
|
make mig-cmd && \
|
2014-03-26 22:57:24 +04:00
|
|
|
make mig-api && \
|
2015-08-23 04:44:02 +03:00
|
|
|
make mig-scheduler && \
|
2014-03-26 22:57:24 +04:00
|
|
|
echo success $(date +%H:%M:%S)
|
2014-02-24 09:45:54 +04:00
|
|
|
|
|
|
|
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)
|
2014-02-24 09:45:54 +04:00
|
|
|
|
|
|
|
fi
|
|
|
|
done
|