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

123456789101112131415161718192021222324252627282930313233343536
  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. if ! qvm-create-default-dvm --used-template --default-script >/var/run/qubes/qvm-create-default-dvm.stdout </dev/null ; then
  27. ret=1
  28. fi
  29. exit $ret