Upgrade-Script für Debian / Raspi OS
Abhängigkeiten
Das Script benötigt das Tool needrestart:
apt install needrestart
Installation
Das Script in die Shell kopieren um es in die Datei debianupdate.sh zu übertragen:
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
Danach die Berechtigungen ändern:
chmod 500 /root/debianupdate.sh
Ausführen
Ausführen des Upgrades mit:
./debianupdate.sh