dispvm-prerun.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh
  2. apps="evince /usr/libexec/evinced soffice firefox"
  3. #If user have customized DispVM settings, use its home instead of default dotfiles
  4. if [ -e /rw/home/user/.qubes-dispvm-customized ]; then
  5. cp -af /rw/home/user /home/
  6. else
  7. cat /etc/dispvm-dotfiles.tbz | tar -xjf- --overwrite -C /home/user --owner user 2>&1 >/tmp/dispvm-dotfiles-errors.log
  8. fi
  9. for app in $apps ; do
  10. echo "Launching: $app..."
  11. $app >>/tmp/dispvm_prerun_errors.log 2>&1 &
  12. done
  13. echo "Sleeping..."
  14. PREV_IO=0
  15. while true; do
  16. IO=`vmstat -D | awk '/read|write/ {IOs+=$1} END {print IOs}'`
  17. if [ $IO -lt $[ $PREV_IO + 50 ] ]; then
  18. break;
  19. fi
  20. PREV_IO=$IO
  21. sleep 1
  22. done
  23. ps ax > /tmp/dispvm-prerun-proclist.log
  24. echo "Closing windows..."
  25. /usr/lib/qubes/close-window `xwininfo -root -children|tail -n +7 |awk '{print $1}'`
  26. sleep 1
  27. if [ -e /rw/home/user/.qubes-dispvm-customized ]; then
  28. cp -af /rw/home/user /home/
  29. else
  30. cat /etc/dispvm-dotfiles.tbz | tar -xjf- --overwrite -C /home/user --owner user 2>&1 >>/tmp/dispvm-dotfiles-errors.log
  31. fi
  32. echo done.