Merge branch 'osx-explorers' of https://github.com/mhutter/cdist

remotes/origin/random_dot_cdist
Nico Schottelius 11 years ago
commit 8a56883d83
  1. 23
      cdist/conf/explorer/cpu_cores
  2. 21
      cdist/conf/explorer/cpu_sockets
  3. 15
      cdist/conf/explorer/memory

@ -22,10 +22,19 @@
# FIXME: other system types (not linux ...)
if [ -r /proc/cpuinfo ]; then
cores="$(cat /proc/cpuinfo | grep "core id" | sort | uniq | wc -l)"
if [ ${cores} -eq 0 ]; then
cores="1"
fi
echo "${cores}"
fi
os=$("$__explorer/os")
case "$os" in
"macosx")
echo "$(sysctl -n hw.physicalcpu)"
;;
*)
if [ -r /proc/cpuinfo ]; then
cores="$(grep "core id" /proc/cpuinfo | sort | uniq | wc -l)"
if [ ${cores} -eq 0 ]; then
cores="1"
fi
echo "$cores"
fi
;;
esac

@ -22,10 +22,19 @@
# FIXME: other system types (not linux ...)
if [ -r /proc/cpuinfo ]; then
sockets="$(cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l)"
if [ ${sockets} -eq 0 ]; then
sockets="$(cat /proc/cpuinfo | grep "processor" | wc -l)"
os=$("$__explorer/os")
case "$os" in
"macosx")
echo "$(system_profiler SPHardwareDataType | grep "Number of Processors" | awk -F': ' '{print $2}')"
;;
*)
if [ -r /proc/cpuinfo ]; then
sockets="$(grep "physical id" /proc/cpuinfo | sort | uniq | wc -l)"
if [ ${sockets} -eq 0 ]; then
sockets="$(cat /proc/cpuinfo | grep "processor" | wc -l)"
fi
echo "${sockets}"
fi
echo "${sockets}"
fi
;;
esac

@ -22,6 +22,15 @@
# FIXME: other system types (not linux ...)
if [ -r /proc/meminfo ]; then
echo "$(cat /proc/meminfo | grep "MemTotal:" | awk '{print $2}')"
fi
os=$("$__explorer/os")
case "$os" in
"macosx")
echo "$(sysctl -n hw.memsize)/1024" | bc
;;
*)
if [ -r /proc/meminfo ]; then
grep "MemTotal:" /proc/meminfo | awk '{print $2}'
fi
;;
esac

Loading…
Cancel
Save