dispvm-prerun.sh 884 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. apps="/usr/libexec/evinced"
  3. #If user have customized DispVM settings, use its home instead of default dotfiles
  4. if [ ! -e /home/user/.qubes-dispvm-customized ]; then
  5. if [ -e /rw/home/user/.qubes-dispvm-customized ]; then
  6. cp -af /rw/home/user /home/
  7. else
  8. cat /etc/dispvm-dotfiles.tbz | tar -xjf- --overwrite -C /home/user --owner user 2>&1 >/tmp/dispvm-dotfiles-errors.log
  9. fi
  10. fi
  11. for app in $apps ; do
  12. echo "Launching: $app..."
  13. $app >>/tmp/dispvm_prerun_errors.log 2>&1 &
  14. done
  15. echo "Sleeping..."
  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. ps aufwwx > /tmp/dispvm-prerun-proclist.log
  26. echo "Closing windows..."
  27. /usr/lib/qubes/close-window `xwininfo -root -children|tail -n +7 |awk '{print $1}'`
  28. sleep 1
  29. fuser -vkm /rw
  30. echo done.