Re: Detecting amount of memory?

[email protected]
Newsgroups gmane.linux.redhat.kickstart.general
Message-ID <591391867-1292935156-cardhu_decombobulator_blackberry.rim.net-1942212958-@bda2469.bisx.prod.on.blackberry>
The kernel reports the amount of memory in /proc/meninfo .  It shows the memory information in kilobytes.
James
Sent from my Verizon Wireless BlackBerry

-----Original Message-----
From: Patrick Lists <[email protected]>
Sender: [email protected]
Date: Tue, 21 Dec 2010 13:18:37 
To: Discussion list about Kickstart<[email protected]>
Reply-To: Discussion list about Kickstart <[email protected]>
Subject: Detecting amount of memory?

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
[email protected]
https://www.redhat.com/mailman/listinfo/kickstart-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.