#!/bin/bash # This will install Picasa for the user zenity --info --text "We need to install some files and make some configurations for Picasa to work fine, ok?" function DOWNLOAD { rand="$RANDOM `date`" pipe="/tmp/pipe.`echo '$rand' | md5sum | tr -d ' -'`" mkfifo $pipe cd ~/ wget -c $1 2>&1 | while read data;do if [ "`echo $data | grep '^Length:'`" ]; then total_size=`echo $data | grep "^Length:" | sed 's/.*\((.*)\).*/\1/' | tr -d '()'` fi if [ "`echo $data | grep '[0-9]*%' `" ];then percent=`echo $data | grep -o "[0-9]*%" | tr -d '%'` current=`echo $data | grep "[0-9]*%" | sed 's/\([0-9BKMG.]\+\).*/\1/' ` speed=`echo $data | grep "[0-9]*%" | sed 's/.*\(% [0-9BKMG.]\+\).*/\1/' | tr -d ' %'` remain=`echo $data | grep -o "[0-9A-Za-z]*$" ` echo $percent echo "# $2\n$current of $total_size ($percent%)\nSpeed: $speed/Sec\nTime to end: $remain" fi done > $pipe & wget_info=`ps ax |grep "wget.*$1" |awk '{print $1"|"$2}'` wget_pid=`echo $wget_info|cut -d'|' -f1 ` zenity --progress --auto-close --text="Conecting...\n\n\n" --width="350" --title="Downloading"< $pipe if [ "`ps -A |grep "$wget_pid"`" ];then kill $wget_pid fi rm -f $pipe } DOWNLOAD "http://dl.google.com/picasa/picasa39-setup.exe" "Downloading Picasa from Google..." zenity --info --text 'Now we are going to install Picasa, please do UNCHECK "Run Picasa 3" at the end of this process.' wine ~/picasa39-setup.exe zenity --info --text 'Now we are going to fix the login.' env WINEARCH=win32 WINEPREFIX=~/.tmp winetricks ie6 | zenity --progress --auto-close --text="This is needed to login correctly at Google.\n\n This can take a few minutes, please be patient." --title="Installing IE6 in wine" cp -r ~/.tmp/* ~/.wine/ touch ~/.firstpicasarun zenity --question --text "Finished! Do you want to open Picasa now?" && wine ~/.wine/drive_c/Program\ Files\ \(x86\)/Google/Picasa3/Picasa3.exe exit 0