From 5e36d8d7607de4b5d675de3d1b7f96cda0d8af71 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 5 Aug 2011 09:46:16 +0000 Subject: [PATCH] * PEAR/Email: fixed not working automatic install of Mail_Mime because PEAR in RHEL5 is way to old --- doc/rpm-build/post_install.php | 41 +++++++++++++++++++++++++++------- felamimail/setup/setup.inc.php | 1 + 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/doc/rpm-build/post_install.php b/doc/rpm-build/post_install.php index 72767ce2d8..a35962b264 100755 --- a/doc/rpm-build/post_install.php +++ b/doc/rpm-build/post_install.php @@ -529,7 +529,7 @@ function check_install_pear_packages() } } // read required packages from apps - $packages = array('HTTP_WebDAV_Server' => '999.egw-pear'); + $packages = array('PEAR' => true, 'HTTP_WebDAV_Server' => '999.egw-pear'); // pear must be the first, to run it's update first! $egw_pear_packages = array(); foreach(scandir($config['source_dir']) as $app) { @@ -543,14 +543,18 @@ function check_install_pear_packages() { if ($args['func'] == 'pear_check') { - $packages[$package?$package:'PEAR'] = isset($args['version']) ? $args['version'] : true; + if (!$package) $package = 'PEAR'; + // only overwrite lower version or no version + if (!isset($packages[$package]) || $packages[$package] === true || isset($args['version']) && version_compare($args['version'],$packages[$package],'>')) + { + $packages[$package] = isset($args['version']) ? $args['version'] : true; + } } } } if ($app == 'egw-pear') { - $egw_pear_packages['HTTP_WebDAV_Server'] = $egw_pear_packages['Net_Socket'] = - $egw_pear_packages['Net_IMAP'] = $egw_pear_packages['Net_Sieve'] = $egw_pear_packages['Log'] = '999.egw-pear'; + $egw_pear_packages['HTTP_WebDAV_Server'] = $egw_pear_packages['Net_IMAP'] = $egw_pear_packages['Net_Sieve'] = $egw_pear_packages['Log'] = '999.egw-pear'; } } //echo 'Installed: '; print_r($packages_installed); @@ -567,6 +571,8 @@ function check_install_pear_packages() $need_upgrade[] = $package; } } + //echo 'Need upgrade: '; print_r($need_upgrade); + //echo 'To install: '; print_r($to_install); if (($to_install || $need_upgrade)) { if (getmyuid()) @@ -576,8 +582,24 @@ function check_install_pear_packages() else { echo "Install/upgrade required PEAR packages:\n"; - if ($to_install) system($config['pear'].' install '.implode(' ',$to_install)); - if ($need_upgrade) system($config['pear'].' upgrade '.implode(' ',$need_upgrade)); + // need to run upgrades first, they might be required for install! + if ($need_upgrade) + { + if (in_array('PEAR',$need_upgrade)) // updating pear itself can be very tricky, this is what's needed for stock RHEL pear + { + $cmd = $config['pear'].' channel-update pear.php.net'; + echo "$cmd\n"; system($cmd); + $cmd = $config['pear'].' upgrade --force Console_Getopt Archive_Tar'; + echo "$cmd\n"; system($cmd); + } + $cmd = $config['pear'].' upgrade '.implode(' ',$need_upgrade); + echo "$cmd\n"; system($cmd); + } + if ($to_install) + { + $cmd = $config['pear'].' install '.implode(' ',$to_install); + echo "$cmd\n"; system($cmd); + } } } } @@ -591,6 +613,9 @@ function fix_perms() { global $config; - system('/bin/chown -R '.$config['webserver_user'].' /tmp/egw_cache'); - system('/bin/chmod 700 /tmp/egw_cache'); + if (file_exists('/tmp/egw_cache')) + { + system('/bin/chown -R '.$config['webserver_user'].' /tmp/egw_cache'); + system('/bin/chmod 700 /tmp/egw_cache'); + } } diff --git a/felamimail/setup/setup.inc.php b/felamimail/setup/setup.inc.php index 45b825fe08..7e24b426f8 100644 --- a/felamimail/setup/setup.inc.php +++ b/felamimail/setup/setup.inc.php @@ -53,6 +53,7 @@ $setup_info['felamimail']['depends'][] = array( $setup_info['felamimail']['check_install'] = array( '' => array( 'func' => 'pear_check', + 'version' => '1.6.0', // otherwise install of Mail_Mime fails! ), # get's provided by egw-pear temporarly 'Net_Sieve' => array(