zebulon_fr

màj / update-all / whatever you want...

Jun 10th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.51 KB | None | 0 0
  1. #!/bin/bash
  2. shopt -s checkwinsize
  3. export COLUMNS
  4.  
  5. if [ "$USER" != 'root' ]; then
  6.   echo >&2 'this program requires root privileges.'
  7.   exit 1
  8. fi
  9.  
  10. Title() {
  11.     local STRING
  12.     STRING=' '"$*"' '
  13.     while [ ${#STRING} -lt $COLUMNS ]; do
  14.         STRING="$STRING"'          '
  15.     done
  16.     echo -e '\e[34;7;1m'"${STRING:0:$COLUMNS}"'\e[39;27;21m'
  17. }
  18.  
  19. AptGet() {
  20.     Title "$1"
  21.     apt-get "$1" || exit $?
  22.     echo
  23. }
  24.  
  25. for WHAT in check update upgrade dist-upgrade autoremove autoclean clean
  26. do
  27.     AptGet $WHAT
  28. done
  29. echo 'All done.'
Advertisement
Add Comment
Please, Sign In to add comment