diff --git a/harden b/harden index 4341e70..122dde7 100755 --- a/harden +++ b/harden @@ -667,16 +667,13 @@ function update_system { export NEEDRESTART_MODE=a export DEBIAN_PRIORITY=critical # Running sudo with -E will preserve the environment variables set in the script - sudo -E apt update -y && sudo apt upgrade -y # Update the package list and upgrade the packages - sudo -E apt install -y + sudo -E apt update -y && sudo apt upgrade -y && sudo apt autoremove -y && sudo apt autoclean -y # Update the package list, upgrade the packages, remove unnecessary packages and clean old package's cache ;; "dnf") # If the package manager is dnf sudo dnf upgrade -y # Update the package list - sudo dnf install -y ;; "zypper") # If the package manager is zypper sudo zypper update -y # Update the package list - sudo zypper install -y ;; *) # If the package manager is not one of the above, output unsupported package manager