Re: Detecting amount of memory?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You could do 
memGB=$(echo "($memKB/1024)/1000"|bc)

That would seem to work based on your numbers


On 12/21/10 7:18 AM, "Patrick Lists" <ks-list@xxxxxxxxxxxxxxxxx> wrote:

> Hi,
> 
> I trying to create a kickstart script on CentOS 5.5 that installs an RPM
> depending on the amount of memory in the box. For example if the box has
>> = 6GB memory then install RPM2 else install RPM1. With some Googling I
> now have the following snippet:
> 
> %pre
> memKB=$(free|grep Mem|awk '{print$2}')
> memGB=$(echo "($memKB/1024)/1024"|bc)
> BIGMEM=""
> if [ "$memGB" -ge 6 ]; then
>     BIGMEM="6GB"
> fi
> 
> %post
> yum install foobar$BIGMEM-1.0-1.rpm
> 
> The problem is that on a box with 6GB memory this snippet says it does
> not have 6GB mem:
> 
> memKB = 6123716 KB
> memGB = 5 GB
> 
> Anyone know what I am doing wrong?
> 
> Thanks!
> Patrick
> 
> _______________________________________________
> Kickstart-list mailing list
> Kickstart-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/kickstart-list
> 

-- 
Tom Callahan
Technology, Development and Services (TDS)
410-229-1361  Tel
410-229-1512  Fax 
CallahanT@xxxxxxxxxx
Visit TESSCO.com <http://www.tessco.com/>
TESSCO
Your Total Source® for Everything Wireless
Network Infrastructure Equipment
<http://www.tessco.com/products/productHierarchy.do?supertab=L01> | Mobile
Devices & Accessories
<http://www.tessco.com/products/productHierarchy.do?supertab=L02> |
Installation, Test, Equipment & Supplies
<http://www.tessco.com/products/productHierarchy.do?supertab=L03>


_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list



[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux