forked from ungleich-public/cdist
Fixed global explorers on OSX
This commit is contained in:
parent
7674cf139b
commit
c36fba4b99
3 changed files with 44 additions and 16 deletions
|
@ -22,10 +22,19 @@
|
||||||
|
|
||||||
# FIXME: other system types (not linux ...)
|
# FIXME: other system types (not linux ...)
|
||||||
|
|
||||||
if [ -r /proc/cpuinfo ]; then
|
os=$("$__explorer/os")
|
||||||
|
case "$os" in
|
||||||
|
"macosx")
|
||||||
|
echo "$(sysctl -n hw.physicalcpu)"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
if [ -r /proc/cpuinfo ]; then
|
||||||
cores="$(cat /proc/cpuinfo | grep "core id" | sort | uniq | wc -l)"
|
cores="$(cat /proc/cpuinfo | grep "core id" | sort | uniq | wc -l)"
|
||||||
if [ ${cores} -eq 0 ]; then
|
if [ ${cores} -eq 0 ]; then
|
||||||
cores="1"
|
cores="1"
|
||||||
fi
|
fi
|
||||||
echo "${cores}"
|
echo "$cores"
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
|
@ -22,10 +22,19 @@
|
||||||
|
|
||||||
# FIXME: other system types (not linux ...)
|
# FIXME: other system types (not linux ...)
|
||||||
|
|
||||||
if [ -r /proc/cpuinfo ]; then
|
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="$(cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l)"
|
sockets="$(cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l)"
|
||||||
if [ ${sockets} -eq 0 ]; then
|
if [ ${sockets} -eq 0 ]; then
|
||||||
sockets="$(cat /proc/cpuinfo | grep "processor" | wc -l)"
|
sockets="$(cat /proc/cpuinfo | grep "processor" | wc -l)"
|
||||||
fi
|
fi
|
||||||
echo "${sockets}"
|
echo "${sockets}"
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
|
@ -22,6 +22,16 @@
|
||||||
|
|
||||||
# FIXME: other system types (not linux ...)
|
# FIXME: other system types (not linux ...)
|
||||||
|
|
||||||
if [ -r /proc/meminfo ]; then
|
os=$("$__explorer/os")
|
||||||
|
case "$os" in
|
||||||
|
"macosx")
|
||||||
|
let memsize=$(sysctl -n hw.memsize)/1024
|
||||||
|
echo "$memsize"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
if [ -r /proc/meminfo ]; then
|
||||||
echo "$(cat /proc/meminfo | grep "MemTotal:" | awk '{print $2}')"
|
echo "$(cat /proc/meminfo | grep "MemTotal:" | awk '{print $2}')"
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
Loading…
Reference in a new issue