2014-02-18 22:14:43 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-09-04 04:56:29 +00:00
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
2014-03-29 03:28:22 +00:00
|
|
|
set -eu
|
|
|
|
set -o pipefail
|
|
|
|
|
2015-11-25 03:31:50 +00:00
|
|
|
YUM=${YUM:-yum}
|
2014-02-18 22:14:43 +00:00
|
|
|
|
2015-11-25 03:31:50 +00:00
|
|
|
if [[ ${YUM} == "dnf" ]]; then
|
|
|
|
# cribbed from
|
|
|
|
# http://dnf.readthedocs.org/en/latest/cli_vs_yum.html
|
|
|
|
_old_kernels="$(dnf repoquery --installonly --latest-limit -1 -q)"
|
|
|
|
if [[ -n "${_old_kernels}" ]]; then
|
|
|
|
dnf remove -y ${_old_kernels}
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
install-packages yum-utils
|
|
|
|
package-cleanup --oldkernels -y --count=1
|
|
|
|
fi
|