2017-03-21 21:58:13 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2019-07-11 14:34:03 +00:00
|
|
|
# kB disable if mem low than 256MB
|
|
|
|
memtotal=`grep MemTotal /proc/meminfo | awk '{print $2}'`
|
|
|
|
if test $memtotal -le 262144; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
KZ=128
|
|
|
|
if test $memtotal -ge 8388608; then
|
|
|
|
KZ=512
|
|
|
|
elif test $memtotal -ge 4194304; then
|
|
|
|
KZ=256
|
|
|
|
fi
|
|
|
|
|
2017-03-21 21:58:13 +00:00
|
|
|
case $(uname -m) in
|
|
|
|
i?86|x86_64)
|
|
|
|
if ! grep -q crashkernel /boot/grub/grub.cfg; then
|
|
|
|
mount /boot -o remount,rw
|
2019-07-11 14:34:03 +00:00
|
|
|
sed -i "s/linux.*/& crashkernel=${KZ}M/" /boot/grub/grub.cfg
|
2017-03-21 21:58:13 +00:00
|
|
|
mount /boot -o remount,ro
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|