--- go-pear.orig	2010-08-05 23:26:55.000000000 +0200
+++ go-pear	2010-08-13 15:05:29.753811744 +0200
@@ -116,7 +116,7 @@
 );
 
 $installer_packages = array(
-    'PEAR',
+    'PEAR-stable',
     'Structures_Graph-stable',
     'Archive_Tar-stable',
     'Console_Getopt-stable',
@@ -250,7 +250,7 @@
     }
     // Anything past this step has something to do with the installation    
 }
-
+/*
 if (!WEBINSTALLER) {
     $tty = WINDOWS ? @fopen('\con', 'r') : @fopen('/dev/tty', 'r');
 
@@ -294,7 +294,7 @@
         $http_proxy = $tmp;
     }
 }
-
+*/
 $origpwd = getcwd();
 
 $config_vars = array_keys($config_desc);
@@ -345,7 +345,7 @@
         break;
     }
 }
-
+/*
 while (!WEBINSTALLER) {
     print "
 Below is a suggested file layout for your new PEAR installation.  To
@@ -428,7 +428,7 @@
         }
     }
 }
-
+*/
 ####
 # Installation stuff
 ####
@@ -561,7 +561,7 @@
         ob_start();
     }
 }
-
+/*
 if (!WEBINSTALLER) {
     $msg = "The following PEAR packages are bundled with PHP: " .
         implode(', ', array_keys($pfc_packages));
@@ -571,17 +571,17 @@
     $install_optional_packages = array();
     print "\n";
 }
-
+*/
 ####
 # Download
 ####
 
 if (function_exists('set_include_path')) {
-   set_include_path($ptmp);
+   set_include_path($ptmp . PATH_SEPARATOR . "%%BUNDLEDIR%%");
 } else {
-   ini_set('include_path', $ptmp);
+   ini_set('include_path', $ptmp . PATH_SEPARATOR . "%%BUNDLEDIR%%");
 }
-
+/*
 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');
@@ -606,18 +606,19 @@
 if (!$have_gzip) {
     print "Downloading uncompressed packages\n";
 };
-
+*/
 if ($install_pfc) {
     $to_install = array_merge($installer_packages, array_keys($pfc_packages));
 } else {
     $to_install = $installer_packages;
-
+/*
     // webinstaller allows to choose pfc packages individually
     foreach ($pfc_packages as $pkg => $desc) {
         if (in_array($pkg, $install_optional_packages)) {
             array_push($to_install, $pkg);
         }
     }
+*/
 }
 
 // gopear_bundle usage
@@ -655,9 +656,9 @@
 if ($nobootstrap) {
     print('Using previously install ... ');
     if (function_exists('set_include_path')) {
-        set_include_path($php_dir);
+        set_include_path($php_dir . PATH_SEPARATOR . "%%BUNDLEDIR%%");
     } else {
-        ini_set('include_path', $php_dir);
+        ini_set('include_path', $php_dir . PATH_SEPARATOR . "%%BUNDLEDIR%%");
     }
     include_once 'PEAR.php';
     print "ok\n";
@@ -750,7 +751,7 @@
 if (WEBINSTALLER || isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'local') {
     $config = &PEAR_Config::singleton($prefix."/pear.conf", '');
 } else {
-    $config = &PEAR_Config::singleton();
+    $config = &PEAR_Config::singleton($prefix."/etc/pear.conf", '');
 }
 
 
@@ -821,7 +822,7 @@
 
 
 // Base installation finished
-
+/*
 ini_restore("include_path");
 
 if (!WEBINSTALLER) {
@@ -980,6 +981,7 @@
 if (WINDOWS && !WEBINSTALLER) {
     win32CreateRegEnv();
 }
+*/
 // Set of functions following
 /**
  * Parse the given dirname
@@ -1418,19 +1420,17 @@
         }
     } 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/share/pear';
+        $doc_dir   = '$prefix/share/doc/pear';
         $data_dir  = '$php_dir/data';
         $test_dir  = '$php_dir/tests';
-        $temp_dir   = '$prefix/temp';
-
+  	$temp_dir   = '%%TMPDIR%%';
+/*
         // check if the user has installed PHP with PHP or GNU layout
         if (@is_dir("$prefix/lib/php/.registry")) {
             $php_dir = '$prefix/lib/php';
@@ -1442,6 +1442,7 @@
         } elseif (@is_dir("$prefix/share/php/.registry")) {
             $php_dir = '$prefix/share/php';
         }
+*/
     }
 }
 
