Skip to content

Commit

Permalink
Improvements to install helper
Browse files Browse the repository at this point in the history
Remove debugging stuff
Hide output of building
Add additional check for added module
  • Loading branch information
helhum committed Jul 1, 2012
1 parent 5325bf5 commit 92d9a57
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions install-helper.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
#!/bin/bash
export DEBUG=""
export phpConfigFile=`php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`

function addOptionToPhpConfig() {
if grep -q "$1" $phpConfigFile
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

Expand All @@ -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
}

0 comments on commit 92d9a57

Please sign in to comment.