Skip to content

Instantly share code, notes, and snippets.

@filhodanuvem
Created December 9, 2012 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filhodanuvem/4245107 to your computer and use it in GitHub Desktop.
Save filhodanuvem/4245107 to your computer and use it in GitHub Desktop.
Brincando com shellscript, baixando automaticamente versões do php.
#!/bin/bash
help()
{
echo "help! I need somebody, help!"
exit 1
}
# php-get install 5.5.0 /destiny
if [ $# -lt 2 ];
then
help
fi
path=$3
if [ $# -lt 3 ];
then
path=$PWD
fi
echo $path
# bellow we'll split the version php in parts, how 5.5.0 is 5 , 5 and 0
oIFS=$IFS
IFS='.'
version=($2)
IFS=$oIFS
mirror="http://php.net/get/php-$2.tar.gz/from/br1.php.net/mirror"
if [ ${version[0]} -le 5 ];
then
if [ ${version[0]} -lt 5 ] ;
then
mirror="http://museum.php.net/php${version[0]}/php-$2.tar.gz"
elif [ ${version[1]} -le 3 ] ;
then
if [ ${version[1]} -eq 3 -a ${version[2]} -lt 6 ];
then
mirror="http://museum.php.net/php${version[0]}/php-$2.tar.gz"
elif [ ${version[1]} -lt 3 ];
then
mirror="http://museum.php.net/php${version[0]}/php-$2.tar.gz"
fi
fi
fi
# elif [ ${version[1]} -le 3 -o ( ${version[1]} = 3 -a ${version[2]} < 3 ) ] ;
echo $mirror;
exit 1;
filename="php-$2"
filename_tgz="$filename.tar.gz"
echo "Downloading php version $2 by $mirror"
if `wget -O $path/$filename_tgz $mirror`;
then
echo;
else
echo "Repository $mirror not found"
echo $?
fi
tar -vzxf "$path/$filename_tgz"
cd "$path/$filename"
make clean
#if `make clean`
#then
rm -rf configure
./vcsclean
./buildconf --force
OPTIONS="--with-gd --with-jpeg-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr \
--with-mysql=/usr --enable-bcmath --with-gmp --with-readline \
--with-openssl --with-curl --without-esmtp \
--with-mysqli --enable-pcntl \
--enable-memory-limit --with-mcrypt --with-t1lib \
--enable-debug --with-iconv --enable-wddx --with-pdo-pgsql \
--enable-spl --enable-pdo --with-pdo-mysql --with-pdo-sqlite \
--with-ctype --with-bz2 --enable-mbstring --with-mime-magic \
--with-xmlrpc --with-zlib --disable-zend-memory-manager --with-esmtp \
--with-xsl --enable-exif --enable-soap --enable-ftp"
echo "configurando php para /usr/local/php/$2"
./configure --prefix="$path/$filename/" ${OPTIONS}
#ln -s /usr/local/php/${version}/php $path/php
if [ $1="test" -o $1="install" ]
then
make test
fi
make -j 5
make #install
#fi
@filhodanuvem
Copy link
Author

teste passando com $ php-get install 5.3.7
teste falha com versões inferiores a 5.3.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment