miamondo

system_update.sh

Jan 17th, 2022 (edited)
215
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # Copyright © 2022 Benoît Boudaud <https://miamondo.org/contact>
  4. # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
  5. # License as published by the Free Software Foundation, either version 3 of the License, or any later version.
  6. # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
  7. # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  8. # You should have received a copy of the GNU General Public License along with this program.
  9. # If not, see <http://www.gnu.org/licenses/>
  10.  
  11. # If you want to run this script, you need to be root or to use the sudo command.
  12. # This script takes one parameter which is the user name.
  13. # For instance : ./system_update.sh benoit
  14.  
  15. # Titre et date
  16. echo -e "\nMISE À JOUR DU SYSTÈME\n" > /home/$1/update-result.txt
  17. date >> /home/$1/update-result.txt
  18.  
  19. # Téléchargement des paquets
  20. apt update -y >> /home/$1/update-result.txt
  21.  
  22. # Mise à jour des paquets
  23. apt full-upgrade -y >> /home/$1/update-result.txt
  24.  
  25. # Nettoyage et suppression des paquets inutiles
  26. apt autoremove -y >> /home/$1/update-result.txt
  27.  
  28. # Changement de propriétaire pour le rapport de Màj
  29. chown $1:$1 /home/$1/update-result.txt
  30.  
RAW Paste Data Copied