From 92d9a57a8d20e5f17b7bf26647edf21e4f95b9e7 Mon Sep 17 00:00:00 2001 From: Helmut Hummel Date: Sun, 1 Jul 2012 15:05:19 +0200 Subject: [PATCH] Improvements to install helper Remove debugging stuff Hide output of building Add additional check for added module --- install-helper.sh | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/install-helper.sh b/install-helper.sh index 1e2e309..27a7a6b 100755 --- a/install-helper.sh +++ b/install-helper.sh @@ -1,5 +1,4 @@ #!/bin/bash -export DEBUG="" export phpConfigFile=`php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` function addOptionToPhpConfig() { @@ -7,30 +6,30 @@ function addOptionToPhpConfig() { then echo "Option $1 already added" else - if [ -n "$DEBUG" ] - then - echo "$1 >> $phpConfigFile" - else - echo "$1" >> $phpConfigFile - fi + echo "$1" >> $phpConfigFile fi } function addModuleToPhpConfig() { - addOptionToPhpConfig "extension=$1.so" + if grep -q "$1.so" $phpConfigFile + then + echo "Module $1 already added" + else + addOptionToPhpConfig "extension=$1.so" + fi } function installPhpModule() { case "$1" in -y) - $DEBUG printf "no\n" | pecl install $2 + printf "no\n" | pecl install $2 > /dev/null shift ;; redis) - installRedis + installRedis > /dev/null ;; *) - $DEBUG pecl install $1 + pecl install $1 > /dev/null ;; esac @@ -47,12 +46,12 @@ function installRedis() { _pwd=$PWD mkdir build-environment/phpredis-build cd build-environment/phpredis-build - $DEBUG git clone --depth 1 git://github.com/nicolasff/phpredis.git - $DEBUG cd phpredis - $DEBUG phpize - $DEBUG ./configure - $DEBUG make - $DEBUG sudo make install + git clone --depth 1 git://github.com/nicolasff/phpredis.git + cd phpredis + phpize + ./configure + make + sudo make install cd $_pwd }