42 lines
711 B
Bash
42 lines
711 B
Bash
#!/bin/bash
|
|
|
|
function process_debian()
|
|
{
|
|
## Update repos
|
|
apt-get update
|
|
|
|
## Upgrade packages
|
|
apt-get upgrade --with-new-pkgs -y
|
|
|
|
## Remove unused packages
|
|
apt autoremove
|
|
|
|
## Remove old cached packages
|
|
apt autoclean
|
|
}
|
|
|
|
function process_rhel()
|
|
{
|
|
## Clean cache
|
|
yum clean all
|
|
|
|
## Update all packages, skipping problematic dependencies
|
|
yum update --skip-broken
|
|
}
|
|
|
|
function process_fedora()
|
|
{
|
|
## Update Fedora release
|
|
dnf upgrade --refresh
|
|
}
|
|
|
|
if [ -n "$(command -v apt-get)" ]; then
|
|
process_debian
|
|
elif [ -n "$(command -v yum)" ]; then
|
|
process_rhel
|
|
elif [ -n "$(command -v dnf)" ]; then
|
|
process_fedora
|
|
else
|
|
echo "Package manager not found!"
|
|
fi
|