cvs: pearweb /public_html go-pear
| From: | Stig Bakken | Date: | Fri, 14 Jun 2002 14:32:19 +0000 |
| Subject: | cvs: pearweb /public_html go-pear | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-4617@lists.php.net to get a copy of this message | ||
ssb Fri Jun 14 10:32:19 2002 EDT
Modified files:
/pearweb/public_html go-pear
Log:
* some more Windows fixes (PATH is sometimes called Path)
* use released versions of bootstrap files instead of getting them from HEAD
* add a warning if the installed 'pear' is not in your PATH
Index: pearweb/public_html/go-pear
diff -u pearweb/public_html/go-pear:1.12 pearweb/public_html/go-pear:1.13
--- pearweb/public_html/go-pear:1.12 Fri Jun 14 09:56:31 2002
+++ pearweb/public_html/go-pear Fri Jun 14 10:32:18 2002
@@ -17,7 +17,7 @@
# | Stig Sæther Bakken <stig@php.net> |
# +----------------------------------------------------------------------+
#
-# $Id: go-pear,v 1.12 2002/06/14 13:56:31 cox Exp $
+# $Id: go-pear,v 1.13 2002/06/14 14:32:18 ssb Exp $
#
# Automatically download all the files needed to run the "pear" command
# (the PEAR package installer)
@@ -128,20 +128,8 @@
register_shutdown_function('bail');
-if (my_env('_')) {
- $php = my_env('_');
-} else {
- $php = which('php');
-}
-if (empty($php)) {
- bail("No php cgi binary found in PATH\n");
-}
+print "HTTP proxy (host:port), or Enter for none";
-####
-# User configurable options
-####
-
-print 'HTTP proxy (host:port), or Enter for none';
if (!empty($http_proxy)) {
print " [$http_proxy]";
}
@@ -223,9 +211,10 @@
}
}
-print "
-Do you want to install the PEAR packages bundled with PHP?
-This packages are: " . implode(', ', $pfc_packages) . ". [Y/n] : ";
+$msg = "The following PEAR packages are bundled with PHP: " .
+implode(', ', $pfc_packages);
+print "\n" . wordwrap($msg, 75) . ".\n";
+print "Would you like to install these as well? [Y/n] : ";
$install_pfc = !stristr(fgets($tty, 1024), "n");
print "\n";
@@ -235,6 +224,7 @@
$ptmp = tempnam(tmp_dir(), 'gope');
+
rm_rf($ptmp);
mkdir_p($ptmp, 0700);
chdir($ptmp);
@@ -245,24 +235,6 @@
ini_set("include_path", $ptmp);
-print 'Bootstrapping: PEAR...................';
-$url = 'http://cvs.php.net/co.php/php4/pear/PEAR.php?p=1';
-download_url($url, 'PEAR.php', $http_proxy);
-include_once 'PEAR.php';
-print "ok\n";
-
-print 'Bootstrapping: Archive_Tar............';
-$url = 'http://cvs.php.net/co.php/pear/Archive_Tar/Archive/Tar.php?p=1';
-mkdir('Archive', 0700);
-download_url($url, 'Archive/Tar.php', $http_proxy);
-print "ok\n";
-
-print 'Bootstrapping: Console_Getopt.........';
-$url = 'http://cvs.php.net/co.php/php4/pear/Console/Getopt.php?p=1';
-mkdir('Console', 0700);
-download_url($url, 'Console/Getopt.php', $http_proxy);
-print "ok\n";
-
if (!extension_loaded('zlib')) {
if (WINDOWS) {
@dl('php_zlib.dll');
@@ -288,7 +260,7 @@
$to_install = $installer_packages;
}
-foreach ($to_install as $pkg) {
+foreach ($installer_packages as $pkg) {
$msg = str_pad("Downloading package: $pkg", 38, '.');
print $msg;
$url = sprintf($urltemplate, $pkg);
@@ -296,6 +268,37 @@
print "ok\n";
}
+print 'Bootstrapping: PEAR...................';
+$r = 'RELEASE_' . ereg_replace('[^A-Za-z0-9]', '_',
substr(substr($tarball['PEAR'], 5), 0, -4));
+$url = "http://cvs.php.net/co.php/php4/pear/PEAR.php?p=1&r=$r";
+download_url($url, 'PEAR.php', $http_proxy);
+include_once 'PEAR.php';
+print "ok\n";
+
+print 'Bootstrapping: Archive_Tar............';
+$r = 'RELEASE_' . ereg_replace('[^A-Za-z0-9]', '_',
substr(substr($tarball['Archive_Tar'], 12), 0, -4));
+$url = "http://cvs.php.net/co.php/pear/Archive_Tar/Archive/Tar.php?p=1&r=$r";
+mkdir('Archive', 0700);
+download_url($url, 'Archive/Tar.php', $http_proxy);
+print "ok\n";
+
+print 'Bootstrapping: Console_Getopt.........';
+$r = 'RELEASE_' . ereg_replace('[^A-Za-z0-9]', '_',
substr(substr($tarball['Console_Getopt'], 15), 0, -4));
+$url = "http://cvs.php.net/co.php/php4/pear/Console/Getopt.php?p=1&r=$r";
+mkdir('Console', 0700);
+download_url($url, 'Console/Getopt.php', $http_proxy);
+print "ok\n";
+
+if ($install_pfc) {
+ foreach ($pfc_packages as $pkg) {
+ $msg = str_pad("Downloading package: $pkg", 38, '.');
+ print $msg;
+ $url = sprintf($urltemplate, $pkg);
+ $tarball[$pkg] = download_url($url, null, $http_proxy);
+ print "ok\n";
+ }
+}
+
PEAR::setErrorHandling(PEAR_ERROR_DIE, "\n%s\n");
print 'Extracting installer..................';
$dot = strrpos($tarball['PEAR'], '.');
@@ -343,10 +346,9 @@
print "
******************************************************************************
WARNING! The include_path defined in the currently used php.ini does not
-contain the PEAR PHP directory you just configured.
-
-Current include path: ".ini_get('include_path')."
-Configured directory: $php_dir
+contain the PEAR PHP directory you just specified. If the specified
+directory is also not in the include_path used by your scripts, you
+will have problems getting any PEAR packages working.
";
if (WINDOWS) {
print "
@@ -359,7 +361,13 @@
configuration to make sure $php_dir is in your include_path.
";
}
- print "\nPress Enter to continue: ";
+ $php_ini = PHP_CONFIG_FILE_PATH . DIRECTORY_SEPARATOR . 'php.ini';
+ print "
+Current include path : ".ini_get('include_path')."
+Configured directory : $php_dir
+Currently used php.ini (guess) : $php_ini
+
+Press Enter to continue: ";
fgets($tty, 1024);
if (!WINDOWS) {
print 'Fixing installer include_path.........';
@@ -386,13 +394,25 @@
}
}
-bail();
+$pear_cmd = which('pear');
+$in_path = !empty($pear_cmd);
+if (empty($pear_cmd)) {
+ $pear_cmd = "$bin_dir/pear";
+}
+
+print "The 'pear' command is now at your service at $pear_cmd\n";
+if (!$in_path) {
+ print "
+** The 'pear' command is not currently in your PATH, so you need to
+** use '$pear_cmd' until you have added
+** '$bin_dir' to your PATH environment variable.
-print "
-The 'pear' command is now at your service. Try 'pear list' to see
-what packages are installed, or 'pear help' for help.
+";
+}
+print "Run it without parameters to see the available actions, try 'pear list'
+to see what packages are installed, or 'pear help' for help.
-For more information about PEAR, please check these out:
+For more information about PEAR, see:
http://pear.php.net/faq.php
http://cvs.php.net/co.php/pearweb/doc/pear_package_manager.txt?p=1
@@ -468,9 +488,12 @@
function which($program)
{
- $sep = WINDOWS ? ';' : ':';
- $dirs = explode($sep, my_env('PATH'));
if (WINDOWS) {
+ if (my_env('Path')) {
+ $dirs = explode(';', my_env('Path'));
+ } else {
+ $dirs = explode(';', my_env('PATH'));
+ }
foreach ($dirs as $dir) {
$tmp = "$dir/$program";
if (file_exists($ret = "$tmp.exe") ||
@@ -481,13 +504,14 @@
}
}
} else {
+ $dirs = explode(':', my_env('PATH'));
foreach ($dirs as $dir) {
if (is_executable("$dir/$program")) {
return "$dir/$program";
}
}
}
- return null;
+ return false;
}
// }}}