1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA1 |
3 |
|
4 |
kosmikus wrote: |
5 |
|
6 |
<snip> |
7 |
|
8 |
| |
9 |
| function get-memory-total() { |
10 |
| cat /proc/meminfo | grep MemTotal | sed -r "s/[^0-9]*([0-9]+).*/\1/" |
11 |
| } |
12 |
|
13 |
eureka! what happens when the host OS doesn't have /proc/meminfo? |
14 |
|
15 |
| function check-ram() { |
16 |
| |
17 |
| local mem=$(get-memory-total) |
18 |
| [ $(get-memory-total) -lt 775000 ] && |
19 |
| ( |
20 |
| echo |
21 |
| ewarn "To build Eclipse, at least 768MB of RAM is recommended." |
22 |
| ewarn "Your machine has less RAM. Continuing anyway." |
23 |
| echo |
24 |
| ) |
25 |
| } |
26 |
| |
27 |
|
28 |
I have no problem with what the above code is trying to achieve, just how it |
29 |
goes about doing so. At the very least, it shouldn't assume the existence of a |
30 |
procfs. |
31 |
|
32 |
If you do decide to handle your problem by checking the amount of RAM, please |
33 |
find an alternate way (obviously 'free' can't be used either) or at the very |
34 |
minimum check for file existence. |
35 |
|
36 |
Cheers |
37 |
- -- |
38 |
How many "coming men" has one known! Where on earth do they all go to? |
39 |
-- Sir Arthur Wing Pinero |
40 |
|
41 |
Aaron Walker < ka0ttic@g.o > http://dev.gentoo.org/~ka0ttic/ |
42 |
Gentoo/BSD | *cron | shell-tools http://butsugenjitemple.org/~ka0ttic/ |
43 |
|
44 |
-----BEGIN PGP SIGNATURE----- |
45 |
Version: GnuPG v1.2.6 (GNU/Linux) |
46 |
|
47 |
iD8DBQFBnbb0C3poscuANHARAu0AAJ9KfqTSatJdK7F7co/IcL/wpSOOkgCfRqK2 |
48 |
NjH5EGXZ6UlWJJO9dVCIGVs= |
49 |
=UEV/ |
50 |
-----END PGP SIGNATURE----- |
51 |
|
52 |
|
53 |
-- |
54 |
gentoo-dev@g.o mailing list |