Advertisement
Guest User

LinuxQuestions.org

a guest
Jul 15th, 2011
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.50 KB | None | 0 0
  1. #!/bin/bash
  2. get()
  3. {
  4.     wget http://build.chromium.org/f/chromium/snapshots/Linux/$1/chrome-linux.zip 2>&1 | sed -u 's/.*\ \([0-9]\+%\)\ \+\([0-9.]\+\ [KMB\/s]\+\)$/\1\n# Downloading \2/' | zenity --progress --pulsate --text="Downloading..." &
  5.     RUNNING=0
  6.     while [ $RUNNING -eq 0 ]
  7.     do
  8.     if [ -z "$(pidof zenity)" ]
  9.     then
  10.     pkill wget
  11.     RUNNING=1
  12.     fi
  13.     done
  14. }
  15. menu()
  16. {
  17.     latest=$(curl -s http://build.chromium.org/f/chromium/snapshots/Linux/LATEST)
  18.     yad --title="Chromium Update" --image="gtk-info" \
  19.     --text="Chromium build $latest is the lastest \ndevelopment snapshot build.\n\nContinue to download and unpack?\n" \
  20.     --button="View Changelog:0" --button="No:1" --button="Yes:2"
  21. }
  22. if [ -f "chrome-linux.zip" ] ; then
  23.     rm chrome-linux.zip
  24. fi
  25. menu
  26. case $? in
  27.     "0"*) curl -s http://build.chromium.org/f/chromium/snapshots/Linux/$latest/changelog.xml --output chromium_changelog.xml && yad --width=450 --height=600 --button="OK:0" --text-info --filename=chromium_changelog.xml && rm chromium_changelog.xml && menu ;;
  28.     "1"*) exit ;;
  29.     "2"*) get $latest
  30.         if [ $? -eq 0 ] ; then
  31.             unzip -o chrome-linux.zip -d $HOME/.chromium_latest_snapshot/
  32.             if [ $? -eq 0 ] ; then
  33.                 yad --title="Chromium Update" --image="gtk-apply" --text="<b>\nChromium build $latest installed.    </b>" \
  34.                 --button="OK:0"
  35.                 mv chrome-linux.zip chrome-linux_$latest.zip
  36.             else
  37.                 yad --title="Chromium Update" --image="gtk-dialog-error" --text="<b>\nSomething went wrong!    </b>" \
  38.                 --button="OK:0"
  39.             fi
  40.         fi ;;
  41. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement