Advertisement
MorpheusArch

update_gui.sh

Jul 26th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.10 KB | None | 0 0
  1. #This program is free software; you can redistribute it and/or
  2. #modify it under the terms of the GNU General Public License
  3. #as published by the Free Software Foundation; either version 2
  4. #of the License, or (at your option) any later version.
  5.  
  6. #This program is distributed in the hope that it will be useful,
  7. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  9. #GNU General Public License for more details.
  10.  
  11. #You should have received a copy of the GNU General Public License
  12. #along with this program; if not, write to the Free Software
  13. #Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  14.  
  15. #!/bin/bash
  16.  
  17. # Start apt-get update and pipe output to /tmp.
  18. apt-get update >> /tmp/aptgetupdate.log &
  19. # Keep checking if the process is running. And keep a count.
  20. {
  21.         i="0"
  22.         while (true)
  23.         do
  24.             proc=$(ps aux | grep -v grep | grep -e "apt-get update")
  25.             if [[ "$proc" == "" ]]; then break; fi
  26.             # Sleep for a longer period if the connection is slow
  27.             sleep 1
  28.             echo $i
  29.             i=$(expr $i + 1)
  30.         done
  31.         # If it is done then display 100%
  32.         echo 100
  33.         # Give it some time to display the progress to the user.
  34.         sleep 2
  35. } | whiptail --title "Synchronising Package Databases" --gauge "Please wait..." 8 78 0
  36.  
  37. # Start apt-get upgrade and pipe output to /tmp.
  38. apt-get upgrade -y >> /tmp/aptgetupgrade.log &
  39. # Keep checking if the process is running. And keep a count.
  40. {
  41.         i="0"
  42.         while (true)
  43.         do
  44.             proc=$(ps aux | grep -v grep | grep -e "apt-get upgrade")
  45.             if [[ "$proc" == "" ]]; then break; fi
  46.             # Sleep for a longer period if the connection is slow
  47.             sleep 1
  48.             echo $i
  49.             i=$(expr $i + 1)
  50.         done
  51.         # If it is done then display 100%
  52.         echo 100
  53.         # Give it some time to display the progress to the user.
  54.         sleep 2
  55. } | whiptail --title "Updating system" --gauge "Please wait..." 8 78 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement