From 7b3ea2051fef372fde2d1833b3d8add98c1a54f8 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Tue, 9 Jul 2013 18:15:25 -0700 Subject: [PATCH] Fix package detection on centos in bootstrap Signed-off-by: Josh Durgin --- bootstrap | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/bootstrap b/bootstrap index 3ad528f..e5b2e61 100755 --- a/bootstrap +++ b/bootstrap @@ -1,16 +1,30 @@ #!/bin/sh set -e -for package in python-pip python-virtualenv python-dev libevent-dev; do - if [ "$(dpkg --status -- $package|sed -n 's/^Status: //p')" != "install ok installed" ]; then - # add a space after old values - missing="${missing:+$missing }$package" +if [ -f /etc/debian_version ]; then + for package in python-pip python-virtualenv python-dev libevent-dev; do + if [ "$(dpkg --status -- $package 2>/dev/null|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 +fi +if [ -f /etc/redhat-release ]; then + for package in python-pip python-virtualenv python-devel libevent-devel; do + if [ "$(rpm -qa $package 2>/dev/null)" == "" ]; then + missing="${missing:+$missing }$package" + fi + done + if [ -n "$missing" ]; then + echo "$0: missing required packages, please install them:" 1>&2 + echo " sudo yum install $missing" + exit 1 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 virtualenv --no-site-packages --distribute virtualenv