Added a couple of things to your script. Cancel now works.
#!/bin/bash -l
# getvirtualbox
#
# Copyright (C) 2010 Bill Reynolds <texstar@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# define some variables
#=================================================
TITLE="GetVirtualBox 3.2.2"
package="VirtualBox-3.2.2-62298-Linux_x86.run"
source="http://download.virtualbox.org/virtualbox/3.2.2/"$package
ZEN2="zenity"
exit1=--kill-all
# check for working internet connection
#=================================================
cd /tmp
/bin/rm -f index.html inet.log
MSG=$"Testing your Internet connection..."
( wget --timeout=15 http://www.google.com/index.html -o inet.log ) 2>&1 | $ZEN2 --title="$TITLE" --progress --text "$MSG" --pulsate --auto-close
if [ ! -f /tmp/index.html ]; then
MSG=$"No Internet connection found.\n\nExiting..."
$ZEN2 --title="$TITLE" --error --text "$MSG"
exit 0
fi
# clean up and make sure no partial downloads exist in /tmp
/bin/rm -f index.html inet.log VirtualBox*
if [ $? = 1 ];
then $exit1
fi
# download VirtualBox
#=================================================
#MSG=$"Downloading VirtualBox (53mb). Please be patient..."
wget $source 2>&1 | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | $ZEN2 --width 500 --progress --title="$TITLE" --auto-close
#make file executable
#=================================================
chmod a+x $package
# run the installer
#=================================================
MSG=$"Installing VirtualBox. Please be patient..."
( sh $package ) 2>&1 | $ZEN2 --width 500 --title="$TITLE" --progress --text "$MSG" --pulsate --auto-close
# Create usb group if it doesn't exist, won't hurt if usb group already exists
#=================================================
groupadd usb
# Virtualbox installer automatically adds vboxusers group, yaa
#=================================================
# add users to group vboxusers and usb
#=================================================
SYSUSERS=`cat /etc/passwd | grep "/home/.*/bash" |grep "[0-9][0-9][0-9]" |cut -d: -f1`
for idx in $SYSUSERS; do usermod -G vboxusers,usb $idx; done
# Remove created symlink and make actual desktop file
#=================================================
if [ -f /usr/share/applications/virtualbox.desktop ]; then
/bin/rm -rf /usr/share/applications/virtualbox.desktop
fi
# create menu entry for PCLinuxOS
#=================================================
cat >/usr/share/applications/virtualbox.desktop << EOF
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=Oracle VM VirtualBox
GenericName=Virtual Machine
Type=Application
Exec=VirtualBox
TryExec=VirtualBox
DocPath=file:///opt/VirtualBox/UserManual.pdf
Icon=VBox
Categories=Emulator;System;X-MandrivaLinux-MoreApplications-Emulators;
Comment=Run several virtual systems on a single host computer
EOF
# clean up
#=================================================
/bin/rm -f $package
# the end
#=================================================
MSG=$"VirtualBox is now available from the menu under\nPCmenu -> More Applications -> Emulators.\n\nHave fun\!"
$ZEN2 --width 500 --title="$TITLE" --info --text="$MSG"
exit 0