qubes-update-dispvm-savefile-with-progress.sh 960 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. line1="<b>Please wait (up to 120s) while the DispVM savefile is being updated.</b>"
  3. line2="<i><small>This only happens when you have updated the template.</small></i>"
  4. line3="<i><small>Next time will be much faster.</small></i>"
  5. if type kdialog &> /dev/null; then
  6. ref=`kdialog --title="Updating default DispVM savefile" \
  7. --progressbar \
  8. "<center>
  9. <font>
  10. $line1<br>
  11. $line2<br>
  12. $line3
  13. </font>
  14. </center>" 0`;
  15. trap "qdbus $ref close" EXIT
  16. else
  17. pipe=/tmp/qvm-create-default-dvm-$$.progress
  18. mkfifo $pipe
  19. zenity --progress --pulsate --auto-close --text "$line1\n$line2\n$line3" < $pipe &
  20. exec 5>$pipe
  21. echo 0 >&5
  22. trap "echo 100 >&5" EXIT
  23. fi
  24. #qdbus $ref showCancelButton true;
  25. ret=0
  26. rm -f /var/run/qubes/qvm-create-default-dvm.stdout
  27. if ! qvm-create-default-dvm --used-template --default-script >/var/run/qubes/qvm-create-default-dvm.stdout </dev/null ; then
  28. ret=1
  29. fi
  30. exit $ret