#!/bin/sh

set -e

yum_conf="/etc/yum.conf"
cfg_item="installonly_limit"
num="2"

# Only allow 2 ($num) kernels to be installed at the same time
# on a Centos system.
#
# This is because each kernel takes (together with its rescue version)
# some 70MB in the /boot partitions. 5 kernels almost completely clog
# the /boot partition we have.
if [ -f "$yum_conf" ]; then
	sed -i -e "s/^$cfg_item=.*/$cfg_item=$num/" "$yum_conf"
fi
