This code could be slightly more robust, setting `cores=1` even if `sysctl` fails, and more general, handling BSDs as well as OS X, the conditional logic was changed slightly. I have created a pull request for this variation:

https://github.com/solidsnack/mesos-deb-packaging/pull/3

Let me know what you think.