Fixed global explorers on OSX

OSX may not be widely used, but I figured it's good finger-practice ;-)
I'll look into it tomorrow

Am Dienstag, 17. Juni 2014 schrieb Nico Schottelius :

> In cdist/conf/explorer/cpu_sockets:
>
> > @@ -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="$(cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l)"
> > +        if [ ${sockets} -eq 0 ]; then
> > +            sockets="$(cat /proc/cpuinfo | grep "processor" | wc -l)"
>
> useless use of cat -> can use grep directly (not invited by you, but I see
> this right now)
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/telmich/cdist/pull/345/files#r13885579>.
>