<html><body bgcolor="#FFFFFF"><div><div>Another way to do this is grep for the zone info from dmesg and do the calcs on that info. You need to account for low mem as well which is usually about 800+kb. Also dma etc. I can't remember if dmidecode is available during a kickstart but you could also run that and grep for the dimms (Size: ) should let you see what I mean assuming your not building VMs. <br><br>Sent from my iPod</div><div><br>On Dec 21, 2010, at 1:00 PM, Ohad Levy <<a href="mailto:ohadlevy@gmail.com"><a href="mailto:ohadlevy@gmail.com">ohadlevy@gmail.com</a></a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>bc will round the value down,  you need to change your calculation to round up  or using a different scale.<div><br></div><div>You would need to try it out, maybe something in the spirit of :</div><div><br></div><div>echo "scale 1; $memKB/1024.... |bc</div>
<div>if memGB -ge 5.5 ...</div><div><br></div><div>Ohad</div><div><br></div><div><br><div class="gmail_quote">On Tue, Dec 21, 2010 at 2:18 PM, Patrick Lists <span dir="ltr"><<a href="mailto:ks-list@puzzled.xs4all.nl"></a><a href="mailto:ks-list@puzzled.xs4all.nl"><a href="mailto:ks-list@puzzled.xs4all.nl">ks-list@puzzled.xs4all.nl</a></a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
I trying to create a kickstart script on CentOS 5.5 that installs an RPM<br>
depending on the amount of memory in the box. For example if the box has<br>
>= 6GB memory then install RPM2 else install RPM1. With some Googling I<br>
now have the following snippet:<br>
<br>
%pre<br>
memKB=$(free|grep Mem|awk '{print$2}')<br>
memGB=$(echo "($memKB/1024)/1024"|bc)<br>
BIGMEM=""<br>
if [ "$memGB" -ge 6 ]; then<br>
    BIGMEM="6GB"<br>
fi<br>
<br>
%post<br>
yum install foobar$BIGMEM-1.0-1.rpm<br>
<br>
The problem is that on a box with 6GB memory this snippet says it does<br>
not have 6GB mem:<br>
<br>
memKB = 6123716 KB<br>
memGB = 5 GB<br>
<br>
Anyone know what I am doing wrong?<br>
<br>
Thanks!<br>
Patrick<br>
<br>
_______________________________________________<br>
Kickstart-list mailing list<br>
<a href="mailto:Kickstart-list@redhat.com"></a><a href="mailto:Kickstart-list@redhat.com"><a href="mailto:Kickstart-list@redhat.com">Kickstart-list@redhat.com</a></a><br>
<a href="https://www.redhat.com/mailman/listinfo/kickstart-list" target="_blank"></a><a href="https://www.redhat.com/mailman/listinfo/kickstart-list"><a href="https://www.redhat.com/mailman/listinfo/kickstart-list">https://www.redhat.com/mailman/listinfo/kickstart-list</a></a><br>
</blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Kickstart-list mailing list</span><br><span><a href="mailto:Kickstart-list@redhat.com"><a href="mailto:Kickstart-list@redhat.com">Kickstart-list@redhat.com</a></a></span><br><span><a href="https://www.redhat.com/mailman/listinfo/kickstart-list"><a href="https://www.redhat.com/mailman/listinfo/kickstart-list">https://www.redhat.com/mailman/listinfo/kickstart-list</a></a></span></div></blockquote></div><div><span></span></div></body></html>