Files

42 lines
711 B
Bash
Raw Permalink Normal View History

2020-07-27 14:33:35 -04:00
#!/bin/bash
function process_debian()
{
2020-09-19 11:14:01 -04:00
## Update repos
apt-get update
2020-07-27 14:33:35 -04:00
2020-09-19 11:14:01 -04:00
## Upgrade packages
2021-05-24 14:05:59 -04:00
apt-get upgrade --with-new-pkgs -y
2020-07-27 14:33:35 -04:00
2020-09-19 11:14:01 -04:00
## Remove unused packages
apt autoremove
2020-07-27 14:33:35 -04:00
2020-09-19 11:14:01 -04:00
## Remove old cached packages
apt autoclean
2020-07-27 14:33:35 -04:00
}
function process_rhel()
{
2020-09-19 11:14:01 -04:00
## Clean cache
yum clean all
2020-07-27 14:33:35 -04:00
2020-09-19 11:14:01 -04:00
## Update all packages, skipping problematic dependencies
yum update --skip-broken
2020-07-27 14:33:35 -04:00
}
function process_fedora()
{
2020-09-19 11:14:01 -04:00
## Update Fedora release
dnf upgrade --refresh
2020-07-27 14:33:35 -04:00
}
if [ -n "$(command -v apt-get)" ]; then
2020-09-19 11:14:01 -04:00
process_debian
2020-07-27 14:33:35 -04:00
elif [ -n "$(command -v yum)" ]; then
2020-09-19 11:14:01 -04:00
process_rhel
2020-07-27 14:33:35 -04:00
elif [ -n "$(command -v dnf)" ]; then
2020-09-19 11:14:01 -04:00
process_fedora
2020-07-27 14:33:35 -04:00
else
2020-09-19 11:14:01 -04:00
echo "Package manager not found!"
fi