dispvm-prerun.sh 838 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. # This script must be run as the `user` user.
  3. # It is customarily launched from prepare-dvm.sh.
  4. # At this point, the DispVM home directory customizations
  5. # undertaken by mount-dirs.sh have taken place.
  6. # We know this because dispvm-prerun.sh executes after
  7. # local-fs.target, and mount-dirs.sh runs before it.
  8. me=$( basename "$0" )
  9. apps="/usr/libexec/evinced"
  10. echo "$me started." >&2
  11. for app in $apps ; do
  12. echo "Launching $app" >&2
  13. $app &
  14. done
  15. echo "Waiting for I/O to quiesce" >&2
  16. PREV_IO=0
  17. while true; do
  18. IO=`vmstat -D | awk '/read|write/ {IOs+=$1} END {print IOs}'`
  19. if [ $IO -lt $(( $PREV_IO + 50 )) ]; then
  20. break;
  21. fi
  22. PREV_IO=$IO
  23. sleep 2
  24. done
  25. echo "Closing windows" >&2
  26. /usr/lib/qubes/close-window `xwininfo -root -children|tail -n +7 |awk '{print $1}'`
  27. sleep 1
  28. fuser -vkm /rw
  29. echo "$me finished." >&2