Re: go-pear new version

From: Date: Tue, 26 Mar 2002 08:42:11 +0000
Subject: Re: go-pear new version
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-5108@lists.php.net to get a copy of this message
On Mon, Mar 25, 2002 at 03:55:09PM +0100, Tomas V.V.Cox wrote: > So basically, when someone will do a: > lynx -source http://pear.php.net/~cox/go-pear | sh I like this tool, but I am in so uncomfortable situation, that at work I have to use Solaris instead of linux. > He will get a ready system to use the lastest PEAR DB, Mail, IT, ... and But not on the system without bash - e.g. on Solaris. I have changed go-pear slightly in order to run it on both systems (and it is perhaps more portable). The changes I have made to the script to make it portable: - commands are now executed in backticks cmd not $(cmd) That implies change in the line: -prefix=$(echo $prefix | perl -pe 's/\//\\\//g;'); +prefix=echo $prefix | perl -pe 's#\/#\x5c\/#g;' because \\ was substituted by one \. - test [ ! $variable ] is changed to [ -z "$variable" ] (would check if $variable is empty) - exit -1 is now exit 1 - type -p is substituted with which command -php=$(type -p php) +php=which php I anclose the patch to this letter. Best regards, -- Piotr Klaban

--- go-pear.old Mon Mar 25 16:59:54 2002 +++ go-pear Tue Mar 26 09:15:57 2002 @@ -46,12 +46,12 @@ echo " http://cvs.php.net/co.php/pearweb/doc/pear_package_manager.txt" echo -php=$(type -p php) -if [ ! $php ]; then +php=`which php` +if [ -z "$php" ]; then echo "No php cgi binary found in PATH" - exit -1 + exit 1 fi -prefix=$(echo $php | perl -pe 's/\/bin\/php//') +prefix=`echo $php | perl -pe 's/\/bin\/php//'` TARGET="${prefix}/bin/pear" #### @@ -67,7 +67,7 @@ touch $TARGET > /dev/null if [ $? -ne 0 ]; then echo "Could not create file '$TARGET'" - exit -1 + exit 1 fi echo "Some files need to be installed in your system" @@ -75,18 +75,18 @@ echo "(note that the path has to be in the include_path of your php.ini)" echo -n "[$prefix/lib/php] : " read destdir < /dev/tty -if [ ! $destdir ]; then +if [ -z "$destdir" ]; then destdir="$prefix/lib/php" fi if [ ! -d $destdir ]; then - echo "Directory '$destdir' does not exit or is not a directory" - exit -1 + echo "Directory '$destdir' does not exist or is not a directory" + exit 1 fi echo -n "Do you want to install also the common PEAR files? [Y/n] : " read installall < /dev/tty files="/" -if [ $(echo $installall | grep -i 'n') ]; then +if [ `echo $installall | grep -i 'n'` ]; then files="/scripts/pear.in /Archive/Tar.php /Console/Getopt.php /PEAR.php /System.php /PEAR" fi @@ -94,13 +94,13 @@ # Temp stuff #### -if [ ! $TMPDIR ]; then +if [ -z "$TMPDIR" ]; then TMPDIR=/tmp fi -PTMP=$(date +%s) +PTMP=`date +%s` PTMP="${TMPDIR}/${PTMP}" /bin/rm -rf $PTMP && mkdir -m 0700 -p $PTMP -origpwd=$(pwd) +origpwd=`pwd` cd $PTMP #### @@ -116,7 +116,7 @@ pearin=php4/pear/scripts/pear.in if [ ! -f $pearin ]; then echo "Could not download the files from CVS" - exit -1 + exit 1 fi echo "done!" @@ -130,7 +130,7 @@ # Set the right interpreter for the pear cmd #### -prefix=$(echo $prefix | perl -pe 's/\//\\\//g;'); +prefix=`echo $prefix | perl -pe 's#\/#\x5c\/#g;'` cat $pearin | perl -pe "s/\@prefix@/$prefix/" > $TARGET chmod +x $TARGET
« previous php.pear.dev (#5108) next »