For getting to work this script, packages zenity and xterm must be installed.
The Script:
#!/bin/sh
zenity --question --text "Would you like to check updates?"
if [ $? = 0 ];
then
xterm -e su -c 'xterm -e apt-get update' root
else exit 0
fi
zenity --question --text "Would you like to install updates?"
if [ $? = 0 ];
then
xterm -e su -c 'xterm -e apt-get dist-upgrade' root && zenity --info --text "System Upgraded"
fi
exit 1
##############################################
More simple script, which asks password only once and upgrades the system.
#!/bin/sh
zenity --question --text "Would you like to check and install updates?"
if [ $? = 0 ];
then
xterm -e su -c 'xterm -e apt-get update && apt-get -y dist-upgrade' root && zenity --info --text "System Upgraded"
else exit 0
fi