Created
March 29, 2018 08:40
-
-
Save TimelessP/a8d8d75cc49d4feaf456cfad9884dbad to your computer and use it in GitHub Desktop.
Updates Debian/Ubuntu/Linux Mint and auto-removes unused kernels to keep the boot partition from running out of space.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run this script as root. | |
# Break on any errors. | |
set -e | |
apt-get update | |
dpkg --configure -a | |
apt-get -y autoremove | |
echo "Uninstalling all but the current kernel - $(uname -r)..." | |
apt-get -y remove `dpkg --get-selections | egrep "(linux-image-|linux-headers-|linux-image-extra-)" | grep -v "$(uname -r)" | sed "s/\t.*//gi" | tr '\n' ' '` | |
apt-get -y upgrade | |
apt-get -y dist-upgrade | |
echo "That went well." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment