Upgrade-Script für Debian / Raspi OS

Ein Script zum Updaten von Debian und Raspi OS 

 Abhängigkeiten 

 Das Script ruft das Tool needrestart auf: 

 apt install needrestart 

 Installation 

 Alles in die Shell kopieren um die Datei  debianupdate.sh zu erstellen: 

 cat > /root/debianupdate.sh << EOF

#!/bin/bash

lightblue='\033[1;34m'

lightgreen='\033[1;32m'

lightred='\033[1;31m'

yellow='\033[0;33m'

nocolor='\033[0m'

echo -e "\n\${lightblue}Run command 'apt-get update':\${nocolor}"

apt-get update

echo -e "\${lightgreen}Command 'apt-get update' finished.\${nocolor}"

echo -e "\n\${lightblue}Run command 'apt-get dist-upgrade':\${nocolor}"

apt-get dist-upgrade

echo -e "\${lightgreen}Command 'apt-get dist-upgrade' finished.\${nocolor}"

echo -e "\n\${lightblue}Run command 'apt-get autoremove':\${nocolor}"

apt-get autoremove

echo -e "\${lightgreen}Command 'apt-get autoremove' finished.\${nocolor}"

echo -e "\n\${lightblue}Run command 'apt-get autoclean':\${nocolor}"

apt-get autoclean

echo -e "\${lightgreen}Command 'apt-get autoclean' finished.\${nocolor}"

echo -e "\n${lightblue}Run command 'needrestart' to check which processes need to be restarted after an upgrade:\${nocolor}"

if test -e /usr/sbin/needrestart

then

 needrestart

else

   echo -e "\n\${yellow}Command 'needrestart' not found, use 'apt install needrestart' to install this feature!\${nocolor}"

fi

echo -e "\n\${lightgreen}Update now completed.\${nocolor}"

exit 0

EOF 

 Berechtigungen 

 Die Berechtigungen ändern: 

 chmod 500 /root/debianupdate.sh 

 Ausführen 

 Ausführen des Upgrades mit: 

 ./debianupdate.sh