Advertisement
Scruffle_5758

sys_refresh.sh

Aug 19th, 2020
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.70 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo "System is about to be updated"
  4. sleep 0.2
  5. read -sp "Please type the sudo password for this machine: " sudo_passw
  6.  
  7. if [ -z "$sudo_passw" ]; then
  8.     echo ""
  9.     echo ""
  10.     echo "You must type the sudo password to be able to execute"
  11.     echo "this script"
  12.     echo ""
  13.     exit
  14. else
  15.     :
  16. fi
  17.  
  18. echo ""
  19. read -t 5 -n 1 -r -s -p $'Press any key to continue...\n'
  20.  
  21. echo ""
  22. echo -e "Updating:\t\tsystem"
  23. echo ""
  24. echo ""
  25. echo "$sudo_passw" | sudo -S apt-get -y update
  26. echo ""
  27. echo "System updated"
  28. echo -e "status:\tdone"
  29. echo "----------------------------↓↓--------------------------------"
  30. echo ""
  31.  
  32. #The apt-get autoclean option, like apt-get clean, clears the local repository of retrieved package files,
  33. #but it only removes files that can no longer be downloaded and are virtually useless. It helps to keep your cache
  34. #from growing too large.
  35. echo -e "Removing:\t\tunused files stored in the cache memory"
  36. echo ""
  37. echo ""
  38. echo "$sudo_passw" | sudo -S apt-get -y autoclean
  39. echo ""
  40. echo "Unused cache memory files removed"
  41. echo -e "status:\tdone"
  42. echo "----------------------------↓↓--------------------------------"
  43. echo ""
  44.  
  45. echo -e "Removing:\t\tpackages that were automatically installed and are no longer required"
  46. echo ""
  47. echo ""
  48. echo "$sudo_passw" | sudo -S apt-get -y autoremove
  49. echo ""
  50. echo "Packages that are no longer required removed"
  51. echo -e "status:\tdone"
  52. echo "----------------------------↓↓--------------------------------"
  53. echo ""
  54.  
  55. echo -e "Istanlling:\t\tkernel updates"
  56. echo ""
  57. echo ""
  58. echo "$sudo_passw" | sudo -S apt-get -y dist-upgrade
  59. echo ""
  60. echo "Kernel is now uptodate"
  61. echo -e "status:\tdone"
  62. echo "----------------------------↓↓--------------------------------"
  63. echo ""
  64.  
  65. echo -e "Fixing:\t\tbroken packages"
  66. echo ""
  67. echo "$sudo_passw" | sudo -S dpkg --configure -a
  68. echo ""
  69. echo "Broken packages fixed"
  70. echo -e "status:\tdone"
  71. echo "----------------------------↓↓--------------------------------"
  72. echo ""
  73.  
  74. echo -e "Upgrading:\t\tsystem"
  75. echo ""
  76. echo ""
  77. apt list --upgradable
  78. echo ""
  79. echo "$sudo_passw" | sudo -S apt-get -y upgrade
  80. echo ""
  81. echo "System upgraded"
  82. echo -e "status\tdone"
  83. echo "----------------------------↓↓--------------------------------"
  84. echo ""
  85.  
  86. echo -e "Updating:\t\tsystem"
  87. echo ""
  88. echo ""
  89. echo "$sudo_passw" | sudo -S apt-get -y update
  90. echo ""
  91. echo "System updated"
  92. echo -e "status:\tdone"
  93. echo "----------------------------↓↓--------------------------------"
  94. echo ""
  95.  
  96. echo "Current terminal processes:"
  97. ps
  98. sleep 1s
  99.  
  100. echo ""
  101. echo "Note: if you want to see all the current processes that are"
  102. echo "running on your computer right now type the commap 'top'"
  103. echo ""
  104. exit
  105.  
  106.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement