video_upgrade_wizard 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/sh
  2. #120204 rodin.s: internationalized.
  3. #120323 replace 'xmessage' with 'pupmessage'.
  4. #120331 ping -4 for ipv4, refer: http://murga-linux.com/puppy/viewtopic.php?p=616090#616090
  5. #120525 start fixing this to work with all puppies (not just wary).
  6. export TEXTDOMAIN=vidupgrd___video_upgrade_wizard
  7. export OUTPUT_CHARSET=UTF-8
  8. . gettext.sh
  9. . /etc/DISTRO_SPECS
  10. #new upgrade script, just getting started...
  11. INSERT0=""
  12. XORGVER="`Xorg -version 2>&1 | grep '^X\.Org' | rev | cut -f 1 -d ' ' | rev`" #server version.
  13. [ ! "$XORGVER" ] && XORGVER="1.3" #precaution.
  14. INSERT0=""
  15. INSERT1=""
  16. INSERT1b=""
  17. INSERT2=""
  18. case $DISTRO_COMPAT_VERSION in
  19. wary5)
  20. if vercmp $XORGVER gt 1.5;then
  21. #my xorg 7.6 mega pkg has server 1.11.0
  22. INSERT1="<text><label>`eval_gettext \"Xorg server version '\\\${XORGVER}' is currently running, so it seems that you have already upgraded Xorg.\"`</label></text>"
  23. else
  24. #offer to upgrade...
  25. ping -4 -c 1 www.duckduckgo.com
  26. if [ $? -ne 0 ];then
  27. INSERT0="<text use-markup=\"true\"><label>\"<b>`gettext \"Currently not connected to the Internet. If you wish to connect later, you can run this Video Upgrade Wizard again via the 'setup' icon on the desktop or the 'Setup' category in the menu. Note, to connect to the Internet, click 'connect' icon on left of desktop.\"`</b>\"</label></text>"
  28. fi
  29. INSERT1="<frame $(gettext 'Xorg 7.6 Mega Package')>
  30. <hbox>
  31. <text><label>$(gettext 'Wary can be upgraded from Xorg 7.3 to Xorg 7.6. The PET is large, 21MB. Click button to download and install it:')</label></text>
  32. <vbox>
  33. <button>
  34. <input file>/usr/local/lib/X11/pixmaps/pet48x.png</input>
  35. <action>EXIT:xorg76pet</action>
  36. </button>
  37. </vbox>
  38. </hbox>
  39. </frame>"
  40. INSERT2="<text use-markup=\"true\"><label>\"<b>`gettext \"To decline upgrade, click 'OK' button:\"`</b>\"</label></text>"
  41. fi
  42. ;;
  43. *)
  44. INSERT1="<text><label>`eval_gettext \"Xorg server version '\\\${XORGVER}' is currently running.\"`</label></text>"
  45. INSERT1b="<text><label>$(gettext 'This Wizard is not offering any upgrades.')</label></text>"
  46. ;;
  47. esac
  48. export VIDEOUPGRADE_DLG="<window title=\"$(gettext 'Video Driver Upgrade Wizard')\" icon-name=\"gtk-select-color\">
  49. <vbox>
  50. ${INSERT0}
  51. ${INSERT1}
  52. ${INSERT1b}
  53. <hbox>
  54. ${INSERT2}
  55. <button ok></button>
  56. </hbox>
  57. </vbox>
  58. </window>
  59. "
  60. RETVALS="`gtkdialog3 --program=VIDEOUPGRADE_DLG`"
  61. if [ "`echo "$RETVALS" | grep 'xorg76pet'`" != "" ];then
  62. PETPKG="`grep '|x_xorg76_mega_pkg|' /root/.packages/Packages-puppy-wary5-official | cut -f 8 -d '|'`"
  63. [ "$PETPKG" = "" ] && PETPKG="x_xorg76_mega_pkg-7.6-w5c.pet" #precaution.
  64. cd /root
  65. download_file http://distro.ibiblio.org/quirky/pet_packages-wary5/${PETPKG}
  66. if [ $? -ne 0 ];then
  67. /usr/lib/gtkdialog/box_ok "$(gettext 'Video upgrade wizard')" error "$(gettext 'Sorry, download failed')"
  68. else
  69. petget /root/$PETPKG
  70. rm -f /root/$PETPKG
  71. PKGBASE="`basename $PETPKG .pet`"
  72. if [ ! -f /root/.packages/$PKGBASE.files ];then
  73. /usr/lib/gtkdialog/box_ok "$(gettext 'Video upgrade wizard')" error "$(gettext 'Sorry, something went wrong, package downloaded but is not installed')"
  74. fi
  75. fi
  76. fi