Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- #!/bin/bash
- # Start apt-get update and pipe output to /tmp.
- apt-get update >> /tmp/aptgetupdate.log &
- # Keep checking if the process is running. And keep a count.
- {
- i="0"
- while (true)
- do
- proc=$(ps aux | grep -v grep | grep -e "apt-get update")
- if [[ "$proc" == "" ]]; then break; fi
- # Sleep for a longer period if the connection is slow
- sleep 1
- echo $i
- i=$(expr $i + 1)
- done
- # If it is done then display 100%
- echo 100
- # Give it some time to display the progress to the user.
- sleep 2
- } | whiptail --title "Synchronising Package Databases" --gauge "Please wait..." 8 78 0
- # Start apt-get upgrade and pipe output to /tmp.
- apt-get upgrade -y >> /tmp/aptgetupgrade.log &
- # Keep checking if the process is running. And keep a count.
- {
- i="0"
- while (true)
- do
- proc=$(ps aux | grep -v grep | grep -e "apt-get upgrade")
- if [[ "$proc" == "" ]]; then break; fi
- # Sleep for a longer period if the connection is slow
- sleep 1
- echo $i
- i=$(expr $i + 1)
- done
- # If it is done then display 100%
- echo 100
- # Give it some time to display the progress to the user.
- sleep 2
- } | whiptail --title "Updating system" --gauge "Please wait..." 8 78 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement