$NetBSD: patch-aa,v 1.4 2009/10/29 08:29:03 seb Exp $

--- install/go-pear.php.orig	2009-10-17 09:56:43.000000000 +0000
+++ install/go-pear.php
@@ -252,6 +252,8 @@ if (WEBINSTALLER) {
     // Anything past this step has something to do with the installation    
 }
 
+/*
+
 if (!WEBINSTALLER) {
     $tty = WINDOWS ? @fopen('\con', 'r') : @fopen('/dev/tty', 'r');
 
@@ -296,6 +298,8 @@ If you wish to abort, press Control-C no
     }
 }
 
+*/
+
 $origpwd = getcwd();
 
 $config_vars = array_keys($config_desc);
@@ -347,6 +351,8 @@ we strongly recommand to use it.
     }
 }
 
+/*
+
 while (!WEBINSTALLER) {
     print "
 Below is a suggested file layout for your new PEAR installation.  To
@@ -430,6 +436,8 @@ If you have a CLI (or CGI) php.exe avail
     }
 }
 
+*/
+
 ####
 # Installation stuff
 ####
@@ -564,13 +572,17 @@ if (WEBINSTALLER) {
 }
 
 if (!WEBINSTALLER) {
+/*
     $msg = "The following PEAR packages are bundled with PHP: " .
         implode(', ', array_keys($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");
+*/
     $install_optional_packages = array();
+/*
     print "\n";
+*/
 }
 
 ####
@@ -583,6 +595,8 @@ if (function_exists('set_include_path'))
    ini_set('include_path', $ptmp);
 }
 
+/*
+
 if (!extension_loaded('zlib') && !WEBINSTALLER) { // In Web context we could be in multithread env which makes dl() end up with a fatal error.
     if (WINDOWS) {
         @dl('php_zlib.dll');
@@ -608,6 +622,8 @@ if (!$have_gzip) {
     print "Downloading uncompressed packages\n";
 };
 
+*/
+
 if ($install_pfc) {
     $to_install = array_merge($installer_packages, array_keys($pfc_packages));
 } else {
@@ -749,7 +765,7 @@ include_once "PEAR/Command.php";
 include_once "PEAR/Registry.php";
 
 if (WEBINSTALLER || isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'local') {
-    $config = &PEAR_Config::singleton($prefix."/pear.conf", '');
+    $config = &PEAR_Config::singleton("@WRKSRC@"."/pear.conf", '');
 } else {
     $config = &PEAR_Config::singleton();
 }
@@ -781,7 +797,11 @@ displayHTMLProgress($progress = 45);
 
 $install = &PEAR_Command::factory('install', $config);
 foreach ($to_install as $pkg) {
-    $pkg_basename = substr($pkg, 0, strpos($pkg, '-'));
+    if (strpos($pkg, '-')) {
+        $pkg_basename = substr($pkg, 0, strpos($pkg, '-'));
+    } else {
+        $pkg_basename = $pkg;
+    }
 
     if (in_array($pkg, $installer_packages)) {
         $options = array('nodeps' => true);
@@ -794,7 +814,6 @@ foreach ($to_install as $pkg) {
         continue;
     }
     
-    $pkg_basename = substr($pkg, 0, strpos($pkg, '-'));
     if (in_array($pkg_basename, $bootstrap_pkgs)) {
         print(str_pad("Installing bootstrap package: $pkg_basename", max(50,30+strlen($pkg_basename)+4), '.')."...");
         displayHTMLProgress($progress += round(25 / count($to_install)));
@@ -817,12 +836,17 @@ print "\n".'Making sure every package is
 $install->run('upgrade-all', array('soft' => true), array());
 print "ok\n";
 */
+$config->set('download_dir', '/tmp' . '/download');
+$config->set('temp_dir', '/tmp');
+$config->store();
 unset($config, $registry, $install);
 displayHTMLProgress($progress = 99);
 
 
 // Base installation finished
 
+/*
+
 ini_restore("include_path");
 
 if (!WEBINSTALLER) {
@@ -981,6 +1005,9 @@ if ( WINDOWS ) {
 if (WINDOWS && !WEBINSTALLER) {
     win32CreateRegEnv();
 }
+
+*/
+
 // Set of functions following
 /**
  * Parse the given dirname
@@ -1420,17 +1447,19 @@ function detect_install_dirs($_prefix = 
     } else {
         if ($_prefix === null) {
             #$prefix    = dirname(PHP_BINDIR);
-            $prefix    = dirname(__FILE__);
+            $prefix    = "@PREFIX@";
         } else {
             $prefix = $_prefix;
         }
         $bin_dir   = '$prefix/bin';
         #$php_dir   = '$prefix/share/pear';
-        $php_dir   = '$prefix/PEAR';
-        $doc_dir   = '$php_dir/docs';
+        $php_dir   = '$prefix/lib/php';
+        $doc_dir   = '$php_dir/doc';
         $data_dir  = '$php_dir/data';
-        $test_dir  = '$php_dir/tests';
-        $temp_dir   = '$prefix/temp';
+        $test_dir  = '$php_dir/test';
+        $temp_dir   = '@WRKSRC@/tmp';
+
+/*
 
         // check if the user has installed PHP with PHP or GNU layout
         if (@is_dir("$prefix/lib/php/.registry")) {
@@ -1443,6 +1472,8 @@ function detect_install_dirs($_prefix = 
         } elseif (@is_dir("$prefix/share/php/.registry")) {
             $php_dir = '$prefix/share/php';
         }
+*/
+
     }
 }
 
