From 88a3c36b8e73424c2bfa3d8e3bc4bf2c76e0372f Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Tue, 7 Oct 2014 10:49:40 -0600 Subject: [PATCH] Don't assume Ubuntu; also support MacOS X Signed-off-by: Zack Cerza --- bootstrap | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/bootstrap b/bootstrap index 6e92bb8ea9..0457c5af37 100755 --- a/bootstrap +++ b/bootstrap @@ -1,17 +1,47 @@ #!/bin/sh set -e -for package in python-dev python-pip python-virtualenv libevent-dev python-libvirt; do - if [ "$(dpkg --status -- $package|sed -n 's/^Status: //p')" != "install ok installed" ]; then - # add a space after old values - missing="${missing:+$missing }$package" +case "$(uname -s)" in +Linux) + case "$(lsb_release --id --short)" in + Ubuntu|Debian) + for package in python-dev python-pip python-virtualenv libevent-dev python-libvirt; do + if [ "$(dpkg --status -- $package|sed -n 's/^Status: //p')" != "install ok installed" ]; then + # add a space after old values + missing="${missing:+$missing }$package" + fi + done + if [ -n "$missing" ]; then + echo "$0: missing required packages, please install them:" 1>&2 + echo "sudo apt-get install $missing" + exit 1 + fi + ;; + *) + echo "This script does not support your Linux distribution yet. Patches encouraged!" + exit 1 + ;; + esac + ;; +Darwin) + if ! which brew > /dev/null; then + echo "You need Homebrew: http://brew.sh/" + exit 1 fi -done -if [ -n "$missing" ]; then - echo "$0: missing required packages, please install them:" 1>&2 - echo "sudo apt-get install $missing" + for keg in python libvirt libevent; do + if brew list $keg >/dev/null 2>&1; then + echo "Found $keg" + else + brew install keg + fi + done + ;; +*) + echo "This script does not support your OS yet. Patches encouraged!" exit 1 -fi + ;; +esac +exit if [ -z "$NO_CLOBBER" ] || [ ! -e ./virtualenv ]; then # site packages needed because libvirt python bindings are not nicely -- 2.39.5