build stuff for 1.8, to be tested ;-)

This commit is contained in:
Ralf Becker 2010-09-16 07:58:23 +00:00
parent 50e9fc610c
commit 1404313835
4 changed files with 2341 additions and 0 deletions

View File

@ -0,0 +1,723 @@
#!/usr/bin/php -qC
<?php
/**
* EGroupware - checkout and build EGroupware tgz
*
* @link http://www.egroupware.org
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @author RalfBecker@outdoor-training.de
* @version $Id$
*/
if (isset($_SERVER['HTTP_HOST'])) // security precaution: forbit calling setup-cli as web-page
{
die('<h1>checkout-build-tgz.php must NOT be called as web-page --> exiting !!!</h1>');
}
date_default_timezone_set('Europe/Berlin'); // to get ride of 5.3 warnings
$verbose = 0;
$config = array(
'packagename' => 'egroupware-epl',
'version' => '1.8.001',
'packaging' => date('Ymd'),
'egwdir' => 'egroupware',
'svndir' => '/tmp/build_root/egw_1.8_buildroot-svn',
'egw_buildroot' => '/tmp/build_root/egw_1.8_buildroot',
//'sourcedir' => '/srv/obs/download/stylite-epl/egroupware-epl-10.1',
'svnbase' => 'svn+ssh://svn@dev.egroupware.org/egroupware',
'svnbranch' => 'branches/1.8', // 'branches/1.8' or 'tags/1.6.001'
'svnalias' => 'default-ssh', // default alias
'aliasdir' => 'egroupware', // directory created by the alias
'extra' => array('egw-pear','gallery','phpfreechat'),
'types' => array('tar.bz2','tar.gz','zip'),
'svn' => '/usr/bin/svn',
'clamscan' => '/usr/bin/clamscan',
'freshclam' => '/usr/bin/freshclam',
'gpg' => '/usr/bin/gpg',
'packager' => 'build@stylite.de',
'obs' => false,
'changelog' => false, // eg. '* 1. Zeile\n* 2. Zeile' for debian.changes
'changelog_packager' => 'Ralf Becker <rb@stylite.de>',
'editsvnchangelog' => '* ',
'editor' => '/usr/bin/vi',
'svntag' => 'tags/$version.$packaging', // eg. '$version.$packaging'
'skip' => array(),
'run' => array('svntag','checkout','copy','virusscan','create','sign')
);
// process config from command line
$argv = $_SERVER['argv'];
$prog = array_shift($argv);
while(($arg = array_shift($argv)))
{
if ($arg == '-v' || $arg == '--verbose')
{
++$verbose;
}
elseif($arg == '-h' || $arg == '--help')
{
usage();
}
elseif(substr($arg,0,2) == '--' && isset($config[$name=substr($arg,2)]))
{
$value = array_shift($argv);
switch($name)
{
case 'extra': // stored as array and allow to add/delete items with +/- prefix
case 'types':
case 'skip':
case 'run':
if ($value[0] == '+')
{
$config[$name] = array_unique(array_merge($config[$name],preg_split('/[ ,]+/',$value)));
}
elseif ($value[0] == '-')
{
$config[$name] = array_diff($config[$name],preg_split('/[ ,]+/',$value));
}
else
{
$config[$name] = array_unique(preg_split('/[ ,]+/',$value));
}
break;
case 'svntag':
$config[$name] = $value;
array_unshift($config['run'],'svntag');
break;
case 'editsvnchangelog':
$config[$name] = $value ? $value : true;
if (!in_array('editsvnchangelog',$config['run']))
{
array_unshift($config['run'],'editsvnchangelog');
}
break;
case 'obs':
if (!is_dir($value))
{
usage("Path '$value' not found!");
}
if (!in_array('obs',$config['run'])) $config['run'][] = 'obs';
// fall through
default:
$config[$name] = $value;
break;
}
}
else
{
usage("Unknown argument '$arg'!");
}
}
if ($verbose > 1)
{
echo "Using following config:\n";
print_r($config);
}
$svn = $config['svn'];
foreach(array_diff($config['run'],$config['skip']) as $func)
{
call_user_func('do_'.$func);
}
/**
* Query changelog from svn and let user edit it
*/
function do_editsvnchangelog()
{
global $config,$svn,$verbose;
echo "Querying changelog from SVN\n";
if (!isset($config['modules']))
{
get_modules_per_repro();
}
// query changelog per repo
$changelog = '';
foreach($config['modules'] as $repo => $modules)
{
$branch_url = '';
$revision = null;
foreach($modules as $path => $url)
{
$module = basename($path);
$burl = substr($url,0,-strlen($module)-1);
if (empty($branch_url) || $burl != $branch_url)
{
if (empty($branch_url)) $url = $branch_url = $burl;
//if (count($config['modules']) > 1) $changelog .= $url."\n";
$changelog .= get_changelog_from_svn($url,$config['editsvnchangelog'],$revision);
}
}
}
$logfile = tempnam('/tmp','checkout-build-archives');
file_put_contents($logfile,$changelog);
$cmd = $config['editor'].' '.escapeshellarg($logfile);
passthru($cmd);
$config['changelog'] = file_get_contents($logfile);
// remove trailing newlines
while (substr($config['changelog'],-1) == "\n")
{
$config['changelog'] = substr($config['changelog'],0,-1);
}
// allow user to abort, by deleting the changelog
if (strlen($config['changelog']) <= 2)
{
die("\nChangelog must not be empty --> aborting\n\n");
}
}
/**
* Read changelog for given branch from (last) tag or given revision from svn
*
* @param string $branch_url='svn+ssh://svn@svn.stylite.de/egroupware/branches/Stylite-EPL-10.1'
* @param string $log_pattern=null a preg regular expression or start of line a log message must match, to be returned
* if regular perl regular expression given only first expression in brackets \\1 is used,
* for a start of line match, only the first line is used, otherwise whole message is used
* @param string $revision=null from which to HEAD the log should be retrieved, default search revision of latest tag in ^/tags
* @param string $prefix='* ' prefix, which if not presend should be added to all log messages
*/
function get_changelog_from_svn($branch_url,$log_pattern=null,&$revision,$prefix='* ')
{
//echo __FUNCTION__."('$branch_url','$log_pattern','$revision','$prefix')\n";
global $config,$verbose,$svn;
if (is_null($revision))
{
list($tags_url,$branch) = explode('/branches/',$branch_url);
$tags_url .= '/tags';
$pattern=str_replace('Stylite-EPL-10\.1',preg_quote($branch),'/tags\/(Stylite-EPL-10\.1\.\d{8})/');
$revision = get_last_svn_tag($tags_url,$pattern,$matches);
$tag = $matches[1];
}
elseif(!is_numeric($revision))
{
$revision = get_last_svn_tag($tags_url,$tag=$revision);
}
$cmd = $svn.' log --xml -r '.escapeshellarg($revision.':HEAD').' '.escapeshellarg($branch_url);
if (($v = $verbose))
{
echo "Querying SVN for log from r$revision".($tag ? " ($tag)" : '').":\n$cmd\n";
$verbose = false; // otherwise no $output!
}
$output = array();
run_cmd($cmd,$output);
$verbose = $v;
array_shift($output); // remove the command
$xml = simplexml_load_string($output=implode("\n",$output));
$message = '';
$pattern_len = strlen($log_pattern);
$prefix_len = strlen($prefix);
foreach($xml as $log)
{
$msg = $log->msg;
if ($log_pattern[0] == '/' && preg_match($log_pattern,$msg,$matches))
{
$msg = $matches[1];
}
elseif($log_pattern && $log_pattern[0] != '/' && substr($msg,0,$pattern_len) == $log_pattern)
{
list($msg) = explode("\n",$msg);
}
elseif($log_pattern)
{
continue; // no match --> ignore
}
if ($prefix_len && substr($msg,0,$prefix_len) != $prefix) $msg = $prefix.$msg;
$message .= $msg."\n";
}
if ($verbose) echo $message;
return $message;
}
/**
* Get revision of last svn tag matching a given pattern in the log message
*
* @param string $tags_url
* @param string $pattern which has to be contained in the log message (NOT the tag itself)
* or (perl) regular expression against which log message is matched
* @param array &$matches=null on return matches of preg_match
* @return int revision of last svn tag matching pattern
*/
function get_last_svn_tag($tags_url,$pattern,&$matches=null)
{
global $config,$verbose,$svn;
$cmd = $svn.' log --xml --limit 10 '.escapeshellarg($tags_url);
if (($v = $verbose))
{
echo "Querying SVN for last tags\n$cmd\n";
$verbose = false; // otherwise no $output!
}
$output = array();
run_cmd($cmd,$output);
$verbose = $v;
array_shift($output); // remove the command
$xml = simplexml_load_string($output=implode("\n",$output));
foreach($xml as $log)
{
//print_r($log);
if ($pattern[0] != '/' && strpos($log->msg,$pattern) !== false ||
$pattern[0] == '/' && preg_match($pattern,$log->msg,$matches))
{
if ($verbose) echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n";
return (int)$log['revision'];
}
}
return null;
}
/**
* Copy archive files to obs checkout and commit them
*
*/
function do_obs()
{
global $config,$verbose;
if (!is_dir($config['obs']))
{
usage("Path '$config[obs]' not found!");
}
if ($verbose) echo "Updating OBS checkout\n";
run_cmd('osc up '.$config['obs']);
$n = 0;
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config['obs'])) as $path)
{
if (basename(dirname($path)) == '.osc') continue;
if (!preg_match('/\/'.preg_quote($config['packagename']).'[a-z-]*-'.preg_quote($config['version']).'/',$path)) continue;
if (preg_match('/\/('.preg_quote($config['packagename']).'[a-z-]*)-'.preg_quote($config['version']).'\.[0-9]+(\.tar\.(gz|bz2))$/',$path,$matches) &&
file_exists($new_name=$config['sourcedir'].'/'.$matches[1].'-'.$config['version'].'.'.$config['packaging'].$matches[2]))
{
if (basename($path) != basename($new_name))
{
unlink($path);
if ($verbose) echo "rm $path\n";
}
copy($new_name,dirname($path).'/'.basename($new_name));
if ($verbose) echo "cp $new_name ".dirname($path)."/\n";
++$n;
}
// updating dsc, spec and changelog files
if (substr($path,-4) == '.dsc' || substr($path,-5) == '.spec' ||
!empty($config['changelog']) && basename($path) == 'debian.changes')
{
$content = $content_was = file_get_contents($path);
if (substr($path,-4) == '.dsc' || substr($path,-5) == '.spec')
{
$content = preg_replace('/^Version: '.preg_quote($config['version']).'\.[0-9]+/m','Version: '.$config['version'].'.'.$config['packaging'],$content);
}
if (substr($path,-4) == '.dsc')
{
$content = preg_replace('/^(Debtransform-Tar: '.preg_quote($config['packagename']).'[a-z-]*)-'.
preg_quote($config['version']).'\.[0-9]+(\.tar\.(gz|bz2))$/m',
'\\1-'.$config['version'].'.'.$config['packaging'].'\\2',$content);
}
if (basename($path) == 'debian.changes' && strpos($content,$config['version'].'.'.$config['packaging']) === false)
{
list($new_header) = explode("\n",$content);
$new_header = preg_replace('/\('.preg_quote($config['version']).'.[0-9]+(.*)\)/','('.$config['version'].'.'.$config['packaging'].'\\1)',$new_header);
if (substr($config['changelog'],0,2) != ' ') $config['changelog'] = ' '.implode("\n ",explode("\n",$config['changelog']));
$content = $new_header."\n\n".$config['changelog'].
"\n\n -- ".$config['changelog_packager'].' '.date('r')."\n\n".$content;
}
if (!empty($config['changelog']) && substr($path,-5) == '.spec' &&
($pos_changelog = strpos($content,'%changelog')) !== false)
{
$pos_changelog += strlen("%changelog\n");
$content = substr($content,0,$pos_changelog).' *'.date('D M d Y').' '.$config['changelog_packager']."\n".
$config['changelog']."\n".substr($content,$pos_changelog);
}
if ($content != $content_was)
{
file_put_contents($path,$content);
if ($verbose) echo "Updated $path\n";
++$n;
}
}
}
if ($n)
{
echo "$n files updated in OBS checkout ($config[obs]), commiting them now...\n";
//run_cmd('osc status '.$config['obs']);
run_cmd('osc addremove '.$config['obs'].'/*');
run_cmd('osc commit -m '.escapeshellarg('Version: '.$config['version'].'.'.$config['packaging'].":\n".$config['changelog']).' '.$config['obs']);
}
}
/**
* Sign sha1sum file
*/
function do_sign()
{
global $config,$verbose;
if (substr($config['sourcedir'],0,2) == '~/') // sha1_file cant deal with '~/rpm'
{
$config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1);
}
$sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt';
if (!file_exists($sumsfile))
{
echo "sha1sum file '$sumsfile' not found!\n";
return;
}
// signing it
if (empty($config['gpg']) || !file_exists($config['gpg']))
{
if (!empty($config['gpg'])) echo "{$config['gpg']} not found --> skipping signing sha1sum file!\n";
return;
}
echo "Signing sha1sum file:\n";
if (file_exists($sumsfile.'.asc')) unlink($sumsfile.'.asc');
$cmd = $config['gpg'].' --local-user '.$config['packager'].' --clearsign '.$sumsfile;
run_cmd($cmd);
unlink($sumsfile); // delete the unsigned file
}
/**
* Create archives
*/
function do_create()
{
global $config,$verbose;
if (!file_exists($config['sourcedir'])) mkdir($config['sourcedir'],0755,true);
if (substr($config['sourcedir'],0,2) == '~/') // sha1_file cant deal with '~/rpm'
{
$config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1);
}
$sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt';
$sums = '';
chdir($config['egw_buildroot']);
if($config['extra'])
{
foreach($config['extra'] as $key => $module)
{
if (strpos($module,'/') !== false) $config['extra'][$key] = basename($module);
}
$exclude_extra = ' --exclude=egroupware/'.implode(' --exclude=egroupware/',$config['extra']);
}
foreach($config['types'] as $type)
{
echo "Creating $type archives\n";
$tar_type = $type == 'tar.bz2' ? 'j' : 'z';
$file = $config['sourcedir'].'/'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.'.$type;
switch($type)
{
case 'tar.bz2':
case 'tar.gz':
$cmd = '/bin/tar --owner=root --group=root -c'.$tar_type.'f '.$file.' '.$exclude_extra.' egroupware';
break;
case 'zip':
$cmd = '/bin/mv egroupware/'.implode(' egroupware/',$config['extra']).' . ;';
$cmd .= '/usr/bin/zip -q -r -9 '.$file.' egroupware ;';
$cmd .= '/bin/mv '.implode(' ',$config['extra']).' egroupware';
break;
}
run_cmd($cmd);
$sums .= sha1_file($file)."\t".basename($file)."\n";
foreach($config['extra'] as $module)
{
$file = $config['sourcedir'].'/'.$config['packagename'].'-'.$module.'-'.$config['version'].'.'.$config['packaging'].'.'.$type;
switch($type)
{
case 'tar.bz2':
case 'tar.gz':
$cmd = '/bin/tar --owner=root --group=root -c'.$tar_type.'f '.$file.' egroupware/'.$module;
break;
case 'zip':
$cmd = '/usr/bin/zip -q -r -9 '.$file.' egroupware/'.$module;
break;
}
run_cmd($cmd);
$sums .= sha1_file($file)."\t".basename($file)."\n";
}
}
// writing sha1sum file
file_put_contents($sumsfile,$sums);
}
/**
* Scan checkout for viruses, if clamscan is installed (not fatal if not!)
*/
function do_virusscan()
{
global $config,$verbose;
if (!file_exists($config['clamscan']) || !is_executable($config['clamscan']))
{
echo "Virusscanner '$config[clamscan]' not found --> skipping virus scan!\n";
return;
}
// try updating virus database
if (file_exists($config['freshclam']))
{
echo "Updating virus signatures\n";
$cmd = '/usr/bin/sudo '.$config['freshclam'];
if (!$verbose && function_exists('posix_getuid') && posix_getuid()) echo $cmd."\n";
run_cmd($cmd,$output,1); // 1 = ignore already up to date database
}
echo "Starting virusscan\n";
$cmd = $config['clamscan'].' --quiet -r '.$config['egw_buildroot'];
run_cmd($cmd);
echo "Virusscan successful (no viruses found).\n";
}
/**
* Copy non .svn parts to egw_buildroot and fix permissions and ownership
*/
function do_copy()
{
global $config;
// copy everything, but .svn dirs from svndir to egw_buildroot
echo "Copying non-svn dirs to buildroot\n";
$cmd = '/usr/bin/rsync -r --delete --exclude .svn '.$config['svndir'].'/'.$config['aliasdir'].' '.$config['egw_buildroot'];
run_cmd($cmd);
// fix permissions
echo "Fixing permissions\n";
chdir($config['egw_buildroot'].'/'.$config['aliasdir']);
$cmd = '/bin/chmod -R a-x,u=rwX,g=rX,o=rX .';
run_cmd($cmd);
$cmd = '/bin/chmod +x */*cli.php phpgwapi/cron/*.php svn-helper.php doc/rpm-build/*.php';
run_cmd($cmd);
}
/**
* Checkout or update EGroupware
*
* Ensures an existing checkout is from the correct branch! Otherwise it get's deleted
*/
function do_checkout()
{
global $config,$svn,$verbose;
echo "Starting svn checkout/update\n";
if (!file_exists($config['svndir']))
{
mkdir($config['svndir'],0755,true);
}
elseif (!is_dir($config['svndir']) || !is_writable($config['svndir']))
{
throw new Exception("svn checkout directory '{$config['svndir']} exists and is NO directory or NOT writable!");
}
chdir($config['svndir']);
// do we use a just created tag --> list of taged modules
if ($config['svntag'] && isset($config['modules']))
{
if (file_exists($config['aliasdir']))
{
system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout, as we dont implement switching tags
clearstatcache();
}
foreach($config['modules'] as $repo => $modules)
{
$cmd = $svn.' co ';
foreach($modules as $path => $url)
{
if ($path == $config['aliasdir'])
{
$cmd = $svn.' co '.$repo.'/'.$config['svntag'].'/'.$path;
run_cmd($cmd);
chdir($path);
$cmd = $svn.' co ';
continue;
}
if(file_exists($config['aliasdir']))
{
die("'egroupware' applications must be first one in externals!\n");
}
$cmd .= ' '.$repo.'/'.$config['svntag'].'/'.basename($path);
}
run_cmd($cmd);
}
return;
}
// regular branch update, without tag
$svnbranch = $config['svnbase'].'/'.$config['svnbranch'];
if (file_exists($config['aliasdir']))
{
// check if correct branch
$cmd = 'LANG=C '.$svn.' info';
exec($cmd,$output,$ret);
foreach($output as $line)
{
if ($ret || substr($line,0,5) == 'URL: ')
{
$url = substr($line,5);
if ($ret || substr($url,0,strlen($svnbranch)) != $svnbranch) // wrong branch (or no svn dir)
{
echo "Checkout is of wrong branch --> deleting it\n";
system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout
clearstatcache();
}
break;
}
}
}
$url = $svnbranch.'/'.$config['svnalias'];
$cmd = $svn.' co '.$url.' .';
run_cmd($cmd);
chdir($config['aliasdir']);
foreach($config['extra'] as $module)
{
if (strpos($module,'$') !== false) // allow to use config vars like $svnbranch in module
{
$translate = array();
foreach($config as $name => $value) $translate['$'.$name] = $value;
$module = strtr($module,$translate);
}
$url = strpos($module,'://') === false ? $svnbranch.'/' : '';
$url .= $module;
$cmd = $svn.' co '.$url;
run_cmd($cmd);
}
}
/**
* Get module name per svn repro
*
* @return array with $repro_url => array(module1, ..., moduleN) pairs
*/
function get_modules_per_repro()
{
global $config,$svn,$verbose;
$translate = array();
foreach($config as $name => $value) $translate['$'.$name] = $value;
// process alias/externals
$svnbranch = $config['svnbase'].'/'.$config['svnbranch'];
$url = $svnbranch.'/'.$config['svnalias'];
$cmd = $svn.' propget svn:externals --strict '.$url;
if ($verbose) echo $cmd."\n";
exec($cmd,$output,$ret);
$config['modules'] = array();
foreach($output as $line)
{
$line = trim($line);
if (empty($line) || $line[0] == '#') continue;
list($path,$url) = preg_split('/[ \t\r\n]+/',$line);
if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n");
$repo = $matches[1];
if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://svn@dev.egroupware.org/egroupware';
$config['modules'][$repo][$path] = $url;
}
// process extra modules
foreach($config['extra'] as $module)
{
if (strpos($module,'$') !== false) // allow to use config vars like $svnbranch in module
{
$module = strtr($module,$translate);
}
$url = strpos($module,'://') === false ? $svnbranch.'/' : '';
$url .= $module;
if (strpos($module,'://') !== false) $module = basename($module);
if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n");
$repo = $matches[1];
if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://svn@dev.egroupware.org/egroupware';
$config['modules'][$repo][$config['aliasdir'].'/'.$module] = $url;
}
return $config['modules'];
}
/**
* Create svn tag or branch
*/
function do_svntag()
{
global $config,$svn,$verbose;
$translate = array();
foreach($config as $name => $value) $translate['$'.$name] = $value;
if (strpos($config['svntag'],'$') !== false) // allow to use config vars like $version in tag
{
$config['svntag'] = strtr($config['svntag'],$translate);
}
echo "Creating SVN tag $config[svntag]\n";
if (!isset($config['modules']))
{
get_modules_per_repro();
}
// create tags (per repo)
foreach($config['modules'] as $repo => $modules)
{
$cmd = $svn.' cp --parents -m '.escapeshellarg('Creating '.$config['svntag']).' '.implode(' ',$modules).' '.$repo.'/'.$config['svntag'].'/';
run_cmd($cmd);
}
}
/**
* Runs given shell command, exists with error-code after echoing the output of the failed command (if not already running verbose)
*
* @param string $cmd
* @param array &$output=null $output of command, only if !$verbose !!!
* @param int|array $no_bailout=null exit code(s) to NOT bail out
* @return int exit code of $cmd
*/
function run_cmd($cmd,array &$output=null,$no_bailout=null)
{
global $verbose;
if ($verbose)
{
echo $cmd."\n";
system($cmd,$ret);
}
else
{
$output[] = $cmd;
exec($cmd,$output,$ret);
}
if ($ret && !in_array($ret,(array)$no_bailout))
{
if (!$verbose) echo implode("\n",$output)."\n";
throw new Exception("Error during '$cmd' --> aborting",$ret);
}
return $ret;
}
/**
* Give usage information and an optional error-message, before stoping program execution with exit-code 90 or 0
*
* @param string $error=null optional error-message
*/
function usage($error=null)
{
global $prog,$config;
echo "Usage: $prog [-h|--help] [-v|--verbose] [options, ...]\n\n";
echo "options and their defaults:\n";
foreach($config as $name => $default)
{
if (is_array($default)) $default = implode(' ',$default);
echo '--'.str_pad($name,20).$default."\n";
}
if ($error)
{
echo "$error\n\n";
exit(90);
}
exit(0);
}

View File

@ -0,0 +1,533 @@
egroupware (1.8.001.20100916) hardy; urgency=low
* 1.8.001 release candidate
* Inclusion of postinstall script from EPL (automatic install/update)
* full timezone support including recurring events
* visualisation of participant status of events, mark invitations
* email 3PaneView, folder tree in sidebox, import ical/vcard onclick, select all messages in folder
* Infolog: print and copy
* addressbook mergeprint supports now MS- and OpenOffice xml formats
-- Ralf Becker <rb@stylite.de> Thu, 16 Sep 2010 12:00:00 +0200
egroupware (1.6.001+dfsg-2) unstable; urgency=low
* Upload to unstable (closes: #519566)
[ Jan Wagner ]
* add egroupware-notifications package, cause the application was missing
and it's needed by calendar application
* depend egroupware-calendar on egroupware-notifications (closes: #511913)
[ Peter Eisentraut ]
* Depend egroupware-tracker on egroupware-notifications (closes: #511704)
* Add newline after egw:Modules substitution variable; fixes FTBFS
(closes: #518840) (This is caused by a change in debhelper 7.1.0.)
* Added ${misc:Depends} to all Depends lines, per lintian
-- Peter Eisentraut <petere@debian.org> Fri, 13 Mar 2009 23:38:03 +0200
egroupware (1.6.001+dfsg-1) experimental; urgency=low
* New upstream release
* Updated copyright notices
* Added php5-cli dependency to filemanager application, per lintian
-- Peter Eisentraut <petere@debian.org> Sat, 06 Dec 2008 11:25:37 +0200
egroupware (1.6~rc5-2+dfsg-1) experimental; urgency=low
* New upstream release candidate
-- Peter Eisentraut <petere@debian.org> Tue, 18 Nov 2008 23:30:37 +0200
egroupware (1.6~rc4+dfsg-1) experimental; urgency=low
* New upstream release candidate
- mydms application removed
* Changed watch file temporarily for RC versions
-- Peter Eisentraut <petere@debian.org> Sat, 15 Nov 2008 12:35:17 +0200
egroupware (1.4.004-2.dfsg-4) unstable; urgency=low
* Debconf translation updates (closes: #498957)
-- Peter Eisentraut <petere@debian.org> Thu, 02 Oct 2008 01:02:49 +0300
egroupware (1.4.004-2.dfsg-3) unstable; urgency=low
* Debconf translation updates (closes: #491763)
-- Peter Eisentraut <petere@debian.org> Fri, 12 Sep 2008 15:49:05 +0300
egroupware (1.4.004-2.dfsg-2) unstable; urgency=low
* Debconf translation updates (closes: #480979, #486531, #488573, #489940)
* Renamed README.maintainer to now standardized name README.source
* Updated standards version
* Reference .../doc/egroupware-core/README.Debian.gz with gz suffix
(closes: #489023)
* Removed obsolete lintian overrides
* Simplified setup code, obsoleting 06-egw-header-template.dpatch
* Removed obsolete 08-egw-checkinstall-symlink.dpatch and all of dpatch
* Replaced gawk by perl in debian/rules, simplified code a bit
-- Peter Eisentraut <petere@debian.org> Mon, 14 Jul 2008 14:20:37 +0200
egroupware (1.4.004-2.dfsg-1) unstable; urgency=low
* New upstream release (closes: #476977)
- Obsoletes 01-kses-security.dpatch
* Added Vcs-* control fields for move to collab-maint
* Made egw-sanitize-tarball compatible with uscan and updated watch file to
use it
* Debconf translation updates (closes: #472064, #475252)
-- Peter Eisentraut <petere@debian.org> Fri, 09 May 2008 16:57:05 +0200
egroupware (1.4.002.dfsg-2.1) unstable; urgency=high
* Non-maintainer upload by the Security Team.
* Fix multiple security issues in kses _bad_protocol_once function. Details
are under embargo for now (01-kses-security.dpatch; Closes: #471839).
-- Nico Golde <nion@debian.org> Sat, 22 Mar 2008 16:26:39 +0100
egroupware (1.4.002.dfsg-2) unstable; urgency=low
* Upload to unstable
* Updated standards version
* Converted copyright files to UTF-8
* Added information in egroupware-addressbook/NEWS.Debian about upgrading an
LDAP-based addressbook (closes: #445834)
* Switched back to integrated version of ttf-bitstream-vera, because the
package has been removed (closes: #433807, #447988, #461254)
* Debconf templates and package description review (closes: #464110)
* Debconf translation updates (closes: #465063, #465133, #465799, #467163,
#467173, #467479, #467497, #467536, #468479)
* Added Homepage control field
-- Peter Eisentraut <petere@debian.org> Sat, 01 Mar 2008 19:22:24 +0100
egroupware (1.4.002.dfsg-1) experimental; urgency=low
* New upstream release
- Fixes mishandling of empty web server docroot (closes: #439912)
- Includes fix for cross-site-scripting security problem
(CVE-2007-5091) (closes: #444351)
* Removed obsolete LDAP setup instructions from egroupware-core's
README.Debian (closes: #439323)
-- Peter Eisentraut <petere@debian.org> Thu, 04 Oct 2007 23:22:14 +0200
egroupware (1.4.001.dfsg-2) experimental; urgency=low
* Removed support for Apache 1 and PHP 4 (closes: #432236)
* Replaced ${Source-Version} by ${binary:Version}
* Fixed bugs in translations of debconf templates
* Reenabled outdated translations pt_BR and vi, because the really
outdated parts are now obsolete
-- Peter Eisentraut <petere@debian.org> Mon, 09 Jul 2007 13:05:03 +0200
egroupware (1.4.001.dfsg-1) experimental; urgency=low
* New upstream release
* Removed egroupware-ldap package
* Some installation cleanup
-- Peter Eisentraut <petere@debian.org> Fri, 15 Jun 2007 11:25:39 +0200
egroupware (1.3.023.dfsg-1) experimental; urgency=low
* New upstream release
- workflow application removed
- Obsoletes patch 04-egw-ldap-doc
* Added tracker application
* Updated Apache configuration with upstream recommendations
* Fixed ttf-bitstream-vera handling
* Disabled compression of *.php files installed as documentation
* Some installation cleanup
-- Peter Eisentraut <petere@debian.org> Tue, 29 May 2007 15:18:00 +0200
egroupware (1.3.022.dfsg-1) experimental; urgency=low
* New upstream release
* Updated egw-sanitize-tarball script to exclude debian/ directory
maintained by upstream
-- Peter Eisentraut <petere@debian.org> Mon, 21 May 2007 10:30:53 +0200
egroupware (1.2.106-2.dfsg-3) unstable; urgency=low
* New Galician translation of debconf templates by Jacobo Tarrio
(closes: #412187)
* Only change permissions on /var/lib/egroupware/ during initial
installation, in case someone wants a different setup
(closes: #419094)
-- Peter Eisentraut <petere@debian.org> Fri, 11 May 2007 18:41:23 +0200
egroupware (1.2.106-2.dfsg-2) unstable; urgency=low
* Fixed watch file to ignore beta versions
* New Portuguese translation of debconf templates by Carlos Lisboa
(closes: #409410)
-- Peter Eisentraut <petere@debian.org> Fri, 9 Feb 2007 12:49:08 +0100
egroupware (1.2.106-2.dfsg-1) unstable; urgency=low
* New upstream release
-- Peter Eisentraut <petere@debian.org> Mon, 8 Jan 2007 14:43:34 +0100
egroupware (1.2-106.dfsg-1) unstable; urgency=medium
* New upstream release
* Enabled installation with php5 >=5.2 (closes: #402405)
* Set php_flag display_errors to off to work around php5 bug
* New Spanish translation of debconf templates by César Gómez Martín
(closes: #402306)
* Added PEAR path to open_basedir (closes: #401892, #402720)
-- Peter Eisentraut <petere@debian.org> Tue, 2 Jan 2007 13:38:05 +0100
egroupware (1.2-105.dfsg-4) unstable; urgency=medium
* Disabled installation with php5 >=5.2 (closes: #399832)
* Changed some php_{flag|value} directives to php_admin_{flag|value}
as required
* Disabled outdated translations pt_BR and vi
-- Peter Eisentraut <petere@debian.org> Sat, 2 Dec 2006 10:07:54 +0100
egroupware (1.2-105.dfsg-3) unstable; urgency=low
* Placed php5 dependencies before php4 alternatives
* Raised php4 dependency to 4.3
-- Peter Eisentraut <petere@debian.org> Sat, 4 Nov 2006 17:17:52 +0100
egroupware (1.2-105.dfsg-2) unstable; urgency=medium
* New French translation of debconf templates by "Steve"
(closes: #390186)
* New Japanese translation of debconf templates by Hideki Yamane
(closes: #391806)
-- Peter Eisentraut <petere@debian.org> Fri, 13 Oct 2006 23:36:56 +0200
egroupware (1.2-105.dfsg-1) unstable; urgency=low
* New upstream release
* New Czech translation of debconf templates by Miroslav Kure
(closes: #389217)
-- Peter Eisentraut <petere@debian.org> Sun, 24 Sep 2006 19:33:20 +0200
egroupware (1.2-104.dfsg-3) unstable; urgency=medium
* New Dutch translation of debconf templates by Kurt De Bree
(closes: #387655)
* Added missing build dependency po-debconf
* Added note about tcpip_socket not enabled by default for PostgreSQL
7.4 (closes: #336930)
* Set all of /var/lib/egroupware/ owned by www-data:www-data
* Handle purging egroupware-core when debconf is not installed
(closes: #387980)
-- Peter Eisentraut <petere@debian.org> Mon, 18 Sep 2006 13:40:16 +0200
egroupware (1.2-104.dfsg-2) unstable; urgency=low
* Enhanced watch file
* Enable mod_actions for Apache 2 (closes: #381339)
* Removed recommendations of php5-mcal and php5-xslt, which don't exist
* Altered Debconf templates to fit recommendations in Developer's
Reference
* Code clean-up in maintainer scripts
* Updated setup instructions for new PostgreSQL packaging scheme
* Simplified documentation for LDAP setup
* Added php{4,5}-odbc as dependency alternative
* Updated for new fpdf path
-- Peter Eisentraut <petere@debian.org> Mon, 28 Aug 2006 19:29:49 +0200
egroupware (1.2-104.dfsg-1) unstable; urgency=low
* New upstream release (closes: #362295)
* Dropped 05-egw-projects-jpgraph-path patch because upstream clearly
believes this feature is relevant
* New stuff relative to previous unstable version ...
- New applications: mydms, projectmanager, resources, sambaadmin,
timesheet, workflow
- Dropped applications: backup, comic, email, forum, ftp, fudforum,
headlines, jinn, messenger, phpldapadmin, projects, stocks, tts
(closes: #271058, #271881, #347460, #365314)
- MySQL 5 support (closes: #347480, #372636, #378032)
- XMLRPC variable names fixed (closes: #355956)
- Added PHP5 dependencies as alternatives (closes: #328056, #367397)
- Language installation more robust (closes: #281762)
- IPv6 support (#330873)
- Calendar support for all-day events (closes: #292603)
* Fixed spelling mistake in package description (closes: #363386)
* New Dutch translation of debconf templates by Kurt De Bree
(closes: #363045)
-- Peter Eisentraut <petere@debian.org> Fri, 28 Jul 2006 23:31:57 +0200
egroupware (1.2-102.dfsg-2) experimental; urgency=low
* New upstream release
* Fixed php[45]-gd dependency (closes: #372779)
-- Peter Eisentraut <petere@debian.org> Mon, 12 Jun 2006 10:04:54 +0200
egroupware (1.2-2.dfsg-1) experimental; urgency=low
* New upstream release
* Added PHP5 dependencies as alternatives
* Added Subversion support to egw-sanitize-tarball
* Changed to Debhelper level 5
* Sorted out Build-Depends vs. Build-Depends-Indep
* Changes to default Apache configuration by Lars Kneschke:
- Added /usr/share/php to include_path
- Improved ical handling
- Improved rpc handling
-- Peter Eisentraut <petere@debian.org> Wed, 31 May 2006 15:27:12 +0200
egroupware (1.2-1.dfsg-1) experimental; urgency=low
* New upstream release
- New applications: mydms, projectmanager, resources, sambaadmin,
timesheet, workflow
- Dropped applications: backup, comic, email, forum, ftp, fudforum,
headlines, jinn, messenger, phpldapadmin, projects, stocks, tts
* Most patches obsoleted
* Calculate dependencies of meta package automatically
-- Peter Eisentraut <petere@debian.org> Thu, 20 Apr 2006 17:37:44 +0200
egroupware (1.0.0.009.dfsg-3-4) unstable; urgency=high
* Fixed fudforum arbitrary code execution security problem (CVE-2005-2781)
(closes: #340495)
* Fixed watch file to exclude RC versions
-- Peter Eisentraut <petere@debian.org> Mon, 28 Nov 2005 14:01:13 +0100
egroupware (1.0.0.009.dfsg-3-3) unstable; urgency=high
* Corrected fudforum fix
* Fixed cross-site-scripting [phpsysinfo/includes/system_footer.php,
phpsysinfo/includes/system_header.php,
debian/patches/22-egw-CVE-2005-0870-xss.dpatch]
* Backported parts of changes by Christopher Kunz to fix arbitrary file
inclusion [phpsysinfo/index.php,
debian/patches/23-egw-CVE-2005-3347-file.dpatch]
* Initialise charset variable to fix cross-site scripting
[phpsysinfo/index.php, debian/patches/24-egw-CVE-2005-3348-xss.dpatch]
-- Peter Eisentraut <petere@debian.org> Tue, 15 Nov 2005 00:20:10 +0100
egroupware (1.0.0.009.dfsg-3-2) unstable; urgency=low
* Fixed fudforum cross-site scripting security problem (CAN-2005-2600)
(closes: #323928)
* New Swedish translation of debconf templates by Daniel Nylander
(closes: #333750)
-- Peter Eisentraut <petere@debian.org> Tue, 1 Nov 2005 23:47:36 +0100
egroupware (1.0.0.009.dfsg-3-1) unstable; urgency=high
(The actual upstream release name is "1.0.0.009-3".)
* New upstream release (closes: #329597)
- Obsoletes patch 10-egw-xmlrpc-fix-fix
-- Peter Eisentraut <petere@debian.org> Mon, 26 Sep 2005 11:11:11 +0200
egroupware (1.0.0.009.dfsg-2) unstable; urgency=high
* Added upstream's fix for the previous fix
-- Peter Eisentraut <petere@debian.org> Mon, 5 Sep 2005 11:11:11 +0200
egroupware (1.0.0.009.dfsg-1) unstable; urgency=high
* New upstream release
- Includes fix for (another) XML-RPC remote execution security problem
(CAN-2005-2498) (closes: #323350)
-- Peter Eisentraut <petere@debian.org> Thu, 1 Sep 2005 11:11:11 +0200
egroupware (1.0.0.008-2.dfsg-1) unstable; urgency=low
* New upstream release
* New Czech translation of debconf templates by Miroslav Kure
(closes: #318156)
* Improved version recognition in watch file
-- Peter Eisentraut <petere@debian.org> Fri, 29 Jul 2005 11:11:11 +0200
egroupware (1.0.0.008-1.dfsg-1) unstable; urgency=high
* New upstream release
- Contains better fix for XML-RPC security problem (bug #317263)
- Obsoletes patches 09-egw-calendar-konqueror, 10-egw-pam-auth
-- Peter Eisentraut <petere@debian.org> Sat, 9 Jul 2005 11:11:11 +0200
egroupware (1.0.0.007-3.dfsg-1) unstable; urgency=high
* New upstream release
- Includes fix for XML-RPC remote execution security problem
(CAN-2005-1921) (closes: #317263)
* Updated standards version
-- Peter Eisentraut <petere@debian.org> Thu, 7 Jul 2005 11:11:11 +0200
egroupware (1.0.0.007-2.dfsg-4) unstable; urgency=low
* New Vietnamese translation of debconf templates by Clytie Siddall
(closes: #311614)
* Changed maintainer address
-- Peter Eisentraut <petere@debian.org> Sat, 11 Jun 2005 11:11:11 +0200
egroupware (1.0.0.007-2.dfsg-3) unstable; urgency=medium
* Fixed PAM authentication (closes: #306729)
-- Peter Eisentraut <peter_e@gmx.net> Tue, 24 May 2005 11:11:11 +0200
egroupware (1.0.0.007-2.dfsg-2) unstable; urgency=medium
* Fixed calendar month display in Konqueror
-- Peter Eisentraut <peter_e@gmx.net> Thu, 12 May 2005 11:11:11 +0200
egroupware (1.0.0.007-2.dfsg-1) unstable; urgency=high
* New upstream version
- fixes several security problems (closes: #304496, #305576)
- fixes SQL error in calendar matrix view (closes: #302341)
- skel application removed
* Added php4-cli to dependencies of -fudforum
* Made Apache 2 the preferred web server alternative in dependencies and
debconf question, adjusted debconf translations manually
* Added setup instructions for MySQL (thanks to Christian Motschke)
-- Peter Eisentraut <peter_e@gmx.net> Thu, 21 Apr 2005 11:11:11 +0200
egroupware (1.0.00.006-1.dfsg-1) unstable; urgency=low
* New upstream version
* Adjusted patch egw-projects-jpgraph-path for upstream changes
* Removed patch egw-admin-save-email, obsoleted by upstream changes
* Added patch to ignore dangling symlinks in check_install.php;
phpldapadmin/config.php is initially a dangling symlink, so we don't
want to complain about that.
* Added perl to dependencies of -core (needed for postinst)
-- Peter Eisentraut <peter_e@gmx.net> Mon, 08 Nov 2004 11:11:11 +0100
egroupware (1.0.00.005-1.dfsg-3) unstable; urgency=low
* Converted dpatch to use /usr/share/dpatch/dpatch-run
* No longer set php_flag display_errors off; this should be chosen by
the system administrator or the user.
* -calendar depends on -infolog (closes: #275871)
* New Japanese translation of debconf templates by Hideki Yamane
(closes: #278511)
* Added patch to save email addresses when creating new users
(closes: #270672)
-- Peter Eisentraut <peter_e@gmx.net> Mon, 01 Nov 2004 11:11:11 +0100
egroupware (1.0.00.005-1.dfsg-2) unstable; urgency=low
* Removed PHP conditionals in apache.conf; besides having been
relatively useless, this also gets Apache 2 working.
* Symlinked to ttf-bitstream-vera instead of installing our own copy
* Symlinked to fpdf instead of installing our own copy (except
fpdf.php, which is patched by egroupware)
-- Peter Eisentraut <peter_e@gmx.net> Sat, 25 Sep 2004 11:11:11 +0200
egroupware (1.0.00.005-1.dfsg-1) unstable; urgency=low
* New upstream version
* Added ".dfsg" to version name to make explicit that this is not the
original upstream tarball
* egroupware-infolog.remove now obsolete
* Removed new .htaccess file from installation
* Adjusted patch egw-ldap-doc for upstream changes
* Adjusted patch egw-projects-var-www for upstream changes and renamed
to egw-projects-jpgraph-path
* Added suggestions of php4-imap and php4-auth-pam to -core package
* Removed dependencies on php4-gd2 (see bug #261186)
-- Peter Eisentraut <peter_e@gmx.net> Sat, 11 Sep 2004 11:11:11 +0200
egroupware (1.0.00.004-2+cvs20040825-2) unstable; urgency=low
* Added sitemgr-link symlink into the -sitemgr package
* New Brazilian Portuguese translation of debconf templates by
André Luís Lopes <andrelop@debian.org> (closes: #269531)
* Removed some obsolete files from -filemanager package
* phpldapadmin was by fault in debian/rules filtered from the list of
modules, so it did not get any files installed at all; fixed
* Added symlinks and instructions for setting up a phpldapadmin
configuration file
* Converted the executable dpatch 00template, which doesn't work, to
the nonexecutable variant
-- Peter Eisentraut <peter_e@gmx.net> Sat, 04 Sep 2004 11:11:11 +0200
egroupware (1.0.00.004-2+cvs20040825-1) unstable; urgency=low
* New upstream release plus additional fixes (check out from CVS using
-r Version-1_0_0-branch -D '2004-08-25 00:00:00 UTC')
* Updated egw-ldap-doc patch for new translations
* Sorted out the web server and PHP dependencies:
- Support only Apache variants and PHP as module
- New Apache 2 support (experimental)
- Changed dependency on php4-cgi to php4-cli
* Use invoke-rc.d in maintainer scripts
* Ignore web server reload failures (closes: #267362)
* New French (fr) translation of debconf templates by Florent Usseil
(closes: #267828)
* Added more dependencies on PHP modules in the applications
* Force PHP mbstring overloading to be on
* Remove executable permission from installed PHP files
-- Peter Eisentraut <peter_e@gmx.net> Thu, 26 Aug 2004 11:11:11 +0200
egroupware (1.0.00.003-2-1) unstable; urgency=low
* New upstream release (first stable upstream release, so it can go
into Debian unstable now)
* Patches now handled by dpatch
* More detailed copyright information added
* More careful selection of installed files
* More nonfree files removed from source package
* Dependencies revised
* debian/rules simplified
* Configuration adjusted for new upstream version, web server
selection changed in preparation for more supported servers
-- Peter Eisentraut <peter_e@gmx.net> Tue, 17 Aug 2004 11:11:11 +0200
egroupware (0.9.99.015-1-1) experimental; urgency=low
* Initial release (closes: #237854)
* Removed calendar/doc/rfc2445.txt, because it is not free.
* Changed fudforum setup to work better in Debian directory structure.
-- Peter Eisentraut <peter_e@gmx.net> Fri, 11 Jun 2004 22:37:12 +0200

View File

@ -0,0 +1,593 @@
Name: eGroupware
Version: 1.8.001.20100916
Release:
Summary: EGroupware is a web-based groupware suite written in php.
Group: Web/Database
License: GPLv2
URL: http://www.egroupware.org
Vendor: Stylite GmbH, http://www.stylite.de/
Packager: Ralf Becker <rb@stylite.de>
Prefix: /usr/share
%define egwdir %{prefix}/egroupware
%define egwdatadir /var/lib/egroupware
%if 0%{?suse_version}
%define php php5
%define httpdconfd /etc/apache2/conf.d
%define distribution SUSE Linux %{?suse_version}
%define extra_requires apache2 apache2-mod_php5 php_any_db php5-dom php5-bz2 php5-openssl php5-zip php5-ctype php5-sqlite
%define cron cron
%define apache_user wwwrun
%define apache_group www
%define pear_dir \\/usr\\/share\\/php5\\/PEAR
%else
%define php php
%define httpdconfd /etc/httpd/conf.d
%define cron crontabs
%define apache_user apache
%define apache_group apache
%define pear_dir \\/usr\\/share\\/pear
%endif
%define install_log /root/%{name}-install.log
%define post_install /usr/bin/%{php} %{egwdir}/doc/rpm-build/post_install.php --source_dir %{egwdir} --data_dir %{egwdatadir}
%if 0%{?fedora_version}
%define osversion %{?fedora_version}
%define distribution Fedora Core %{?fedora_version}
%define extra_requires httpd php-mysql php-xml
%endif
%if 0%{?mandriva_version}
%define osversion %{?mandriva_version}
%define distribution Mandriva %{?mandriva_version}
%define extra_requires apache php-mysql php-dom php-pdo_mysql php-pdo_sqlite
# try to keep build from searching (for wrong) dependencys
%undefine __find_provides
%undefine __find_requires
%endif
%if 0%{?rhel_version}
%define osversion %{?rhel_version}
%define distribution Red Hat %{?rhel_version}
%define extra_requires httpd php-mysql php-xml
%endif
%if 0%{?centos_version}
%define osversion %{?centos_version}
%define distribution CentOS %{?centos_version}
%define extra_requires httpd php-mysql php-xml
%endif
Distribution: %{distribution}
Source0: %{name}-%{version}.tar.gz
Source1: %{name}-egw-pear-%{version}.tar.bz2
Source2: %{name}-phpfreechat-%{version}.tar.bz2
Source3: %{name}-gallery-%{version}.tar.bz2
Source4: phpfreechat_data_public.tar.gz
Source5: debian.changes
Source6: %{name}-rpmlintrc
Patch0: class.uiasyncservice.inc.php.patch
BuildRoot: %{_tmppath}/%{name}-buildroot
#otherwise build fails because of jar files in G2
BuildRequires: unzip sed
Buildarch: noarch
AutoReqProv: no
Requires: %{name}-core >= %{version}
Requires: %{name}-egw-pear >= %{version}
#Requires: %{name}-addressbook >= %{version}
Requires: %{name}-bookmarks >= %{version}
Requires: %{name}-calendar >= %{version}
Requires: %{name}-developer_tools >= %{version}
Requires: %{name}-emailadmin >= %{version}
Requires: %{name}-felamimail >= %{version}
Requires: %{name}-filemanager >= %{version}
Requires: %{name}-infolog >= %{version}
Requires: %{name}-importexport >= %{version}
Requires: %{name}-manual >= %{version}
Requires: %{name}-news_admin >= %{version}
Requires: %{name}-notifications >= %{version}
Requires: %{name}-phpbrain >= %{version}
Requires: %{name}-phpfreechat >= %{version}
Requires: %{name}-phpsysinfo >= %{version}
Requires: %{name}-polls >= %{version}
Requires: %{name}-projectmanager >= %{version}
Requires: %{name}-registration >= %{version}
Requires: %{name}-resources >= %{version}
Requires: %{name}-sambaadmin >= %{version}
Requires: %{name}-sitemgr >= %{version}
Requires: %{name}-syncml >= %{version}
Requires: %{name}-timesheet >= %{version}
Requires: %{name}-tracker >= %{version}
Requires: %{name}-wiki >= %{version}
%post
%if 0%{?rhel_version} || 0%{?fedora_version} || 0%{?centos_version}
chcon -R -u user_u -r object_r -t httpd_sys_content_t %{egwdatadir}
setsebool -P httpd_can_network_connect=1
%endif
/bin/date >> %{install_log}
%{post_install} 2>&1 | tee -a %{install_log}
echo "EGroupware install log saved to %{install_log}"
%description
EGroupware is a web-based groupware suite written in PHP.
This package automatically requires the EGroupware default applications:
egroupware core with: admin, api, docs, etemplate, prefereces and setup,
addressbook, bookmarks, calendar, translation-tools, emailadmin, felamimail,
filemanager, infolog, manual, news admin, knowledgebase, polls, phpfreechat,
projectmanager, resources, sambaadmin, sitemgr, syncml, timesheet, tracker, wiki
It also provides an API for developing additional applications.
Further contributed applications are available as separate packages.
%package core
Summary: The EGroupware core
Group: Web/Database
Requires: %{php} >= 5.2.1
Requires: %{php}-mbstring %{php}-gd %{php}-mcrypt %{php}-pear %{php}-posix %{extra_requires} %{cron} zip
Provides: egw-core %{version}
Provides: egw-etemplate %{version}
Provides: egw-addressbook %{version}
Obsoletes: %{name}-addressbook
%description core
This package provides the EGroupware core applications
(API, admin, etemplate, preferences and setup) plus addressbook.
%package egw-pear
Version: %{version}
Summary: The EGroupware egw-pear application
Group: Web/Database
Requires: %{php}-pear
AutoReqProv: no
Requires: egw-core >= %{version}
Provides: egw-pear %{version}
%description egw-pear
egw-pear contains modified pear classes necessary for EGroupware
# addressbook is part of core now, as it contains required classes for accounts
#%package addressbook
#Version: %{version}
#Summary: The EGroupware addressbook application
#Group: Web/Database
#AutoReqProv: no
#Requires: egw-core >= %{version}
#%description addressbook
#Contact manager with Vcard support.
#Addressbook is the egroupware contact application.
#It has different backends to store and retrive contacts
#from SQL or LDAP.
%package bookmarks
Version: %{version}
Summary: The EGroupware bookmarks application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description bookmarks
Manage your bookmarks with EGroupware. Has Netscape plugin.
%package calendar
Version: %{version}
Summary: The EGroupware calendar application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description calendar
Powerful calendar with meeting request system, Alarms, ICal and E-Mail support,
and ACL security.
%package developer_tools
Version: %{version}
Summary: The EGroupware developer_tools application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description developer_tools
The TranslationTools allow to create and extend translations-files for EGroupware.
They can search the sources for new / added phrases and show you the ones missing in your language.
%package emailadmin
Version: %{version}
Summary: The EGroupware emailadmin application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
Requires: %{php}-imap
Requires: %{name}-egw-pear >= %{version}
%description emailadmin
EmailAdmin allow to maintain User email accounts
%package felamimail
Version: %{version}
Summary: The EGroupware Webmail application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
Requires: %{name}-emailadmin >= %{version}
Requires: %{name}-egw-pear >= %{version}
Requires: tnef
%description felamimail
The Email application for EGroupware.
%package filemanager
Version: %{version}
Summary: The EGroupware filemanager application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
Requires: %{name}-egw-pear >= %{version}
%description filemanager
This is the filemanager app for EGroupware.
%package gallery
Version: %{version}
Summary: The EGroupware gallery application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description gallery
An embedded Gallery2 for EGroupware.
%package infolog
Version: %{version}
Summary: The EGroupware infolog application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description infolog
This is the infolog app for EGroupware (Notes, ToDo, Phonelogs, CRM).
%package importexport
Version: %{version}
Summary: The EGroupware importexport application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description importexport
This is the importexport app for EGroupware. It includes a comandline client.
%package manual
Version: %{version}
Summary: The EGroupware manual application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
Requires: %{name}-wiki >= %{version}
%description manual
This is the manual app for EGroupware: online help system.
%package news_admin
Version: %{version}
Summary: The EGroupware news_admin application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description news_admin
This is the news_admin app for EGroupware.
%package notifications
Version: %{version}
Summary: The EGroupware notifications application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description notifications
This is the notifications app for EGroupware.
%package phpbrain
Version: %{version}
Summary: The EGroupware phpbrain application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description phpbrain
This is a knowledgebase for EGroupware.
%package phpfreechat
Version: %{version}
Summary: The EGroupware chat application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description phpfreechat
Chat with other EGroupware users. A port of phpFreeChat for EGroupware.
%package phpsysinfo
Version: %{version}
Summary: The EGroupware phpsysinfo application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description phpsysinfo
This is the phpsysinfo app for EGroupware.
%package polls
Version: %{version}
Summary: The EGroupware polls application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description polls
This is the polls app for EGroupware.
%package projectmanager
Version: %{version}
Summary: The EGroupware projectmanager application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version},
#Requires: jpgraph-epl
%description projectmanager
The projectmanager is EGroupware's new project management application.
It's fully integrated into EGroupware and use the data of InfoLog and Calendar.
Plugable datasources allow to support and manage further applications.
%package registration
Version: %{version}
Summary: The EGroupware registration application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description registration
This is the registration app for EGroupware.
%package resources
Version: %{version}
Summary: The EGroupware resources application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description resources
resources is a resource booking sysmtem for EGroupware.
Which integrates into the calendar.
%package sambaadmin
Version: %{version}
Summary: The EGroupware sambaadmin application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description sambaadmin
Manage LDAP based sambaacounts and workstations.
%package sitemgr
Version: %{version}
Summary: The EGroupware Sitemanager CMS application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description sitemgr
This is the Sitemanager CMS app for EGroupware.
%package syncml
Version: %{version}
Summary: The EGroupware syncml application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
Requires: %{name}-egw-pear >= %{version}
%description syncml
This is the syncml app for EGroupware.
%package timesheet
Version: %{version}
Summary: The EGroupware timesheet application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description timesheet
Simple timesheet application, which allow to record and report
the times and other expenses. It can be uses as well standalone
as together with the ProjectManager application.
%package tracker
Version: %{version}
Summary: The EGroupware trouble ticket system application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version}
%description tracker
This is the trouble ticket system app for EGroupware.
%package wiki
Version: %{version}
Summary: The EGroupware wiki application
Group: Web/Database
AutoReqProv: no
Requires: egw-core >= %{version},
%description wiki
This is the wiki app for EGroupware.
%prep
%setup0 -c -n %{egwdirname}
%setup1 -T -D -a 1 -n %{egwdirname}
%setup2 -T -D -a 2 -n %{egwdirname}
%setup3 -T -D -a 3 -n %{egwdirname}
%setup4 -T -D -a 4 -n %{egwdirname}
%patch0 -p 0
%build
%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
mkdir -p $RPM_BUILD_ROOT%{egwdir}
mkdir -p $RPM_BUILD_ROOT%{httpdconfd}
sed 's/\/usr\/share\/pear/%{pear_dir}/' egroupware/doc/rpm-build/apache.conf > $RPM_BUILD_ROOT%{httpdconfd}/egroupware.conf
mkdir -p $RPM_BUILD_ROOT/etc/cron.d
sed 's/apache/%{apache_user}/' egroupware/doc/rpm-build/egroupware.cron > $RPM_BUILD_ROOT/etc/cron.d/egroupware
mkdir -p $RPM_BUILD_ROOT%{egwdatadir}/default/files
mkdir -p $RPM_BUILD_ROOT%{egwdatadir}/default/backup
cp egroupware/doc/rpm-build/header.inc.php $RPM_BUILD_ROOT%{egwdatadir}
cp -aRf egroupware/* $RPM_BUILD_ROOT%{egwdir}
cd %{buildroot}%{egwdir}
ln -s ../../..%{egwdatadir}/header.inc.php
# create symlink for suse to get scripts with /usr/bin/php working
%if 0%{?suse_version}
#/usr/sbin/update-alternatives --install /usr/bin/php php /usr/bin/php5 99
mkdir %{buildroot}/usr/bin
cd %{buildroot}/usr/bin
ln -s php5 php
%endif
# copy current changelog to doc/rpm-build
install -m 444 %{SOURCE5} $RPM_BUILD_ROOT%{egwdir}/doc/rpm-build
%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
# egroupware metapackage seems to need some files to be build ...
%files
%defattr(-,root,root)
%dir %{egwdir}
%dir %attr(0700,%{apache_user},%{apache_group}) %{egwdatadir}
%files core
%defattr(-,root,root)
%dir %{egwdir}
%{egwdir}/about.php
%{egwdir}/anon_wrapper.php
%{egwdir}/header.inc.php
%{egwdir}/header.inc.php.template
%{egwdir}/index.php
%{egwdir}/login.php
%{egwdir}/logout.php
%{egwdir}/redirect.php
%{egwdir}/rpc.php
%{egwdir}/set_box.php
%{egwdir}/soap.php
%{egwdir}/svn-helper.php
%{egwdir}/xajax.php
%{egwdir}/xmlrpc.php
%{egwdir}/groupdav.php
%{egwdir}/webdav.php
%{egwdir}/addressbook
%{egwdir}/admin
%{egwdir}/doc
%{egwdir}/etemplate
%{egwdir}/home
%{egwdir}/phpgwapi
%{egwdir}/preferences
%{egwdir}/setup
%attr(0644,root,root) /etc/cron.d/egroupware
%config(noreplace) %attr(0644,root,root) %{httpdconfd}/egroupware.conf
%if 0%{?suse_version}
%dir %attr(0755,root,root) /etc/apache2
%dir %attr(0755,root,root) %{httpdconfd}
# symlink for suse to get scripts with /usr/bin/php working
/usr/bin/php
%endif
%dir %attr(0700,%{apache_user},%{apache_group}) %{egwdatadir}
%dir %attr(0700,%{apache_user},%{apache_group}) %{egwdatadir}/default
%dir %attr(0700,%{apache_user},%{apache_group}) %{egwdatadir}/default/files
%dir %attr(0700,%{apache_user},%{apache_group}) %{egwdatadir}/default/backup
%config(noreplace) %attr(0640,%{apache_user},%{apache_group}) %{egwdatadir}/header.inc.php
# addressbook is part of core now, as it contains required classes for accounts
#%files addressbook
#%defattr(-,root,root)
#%{egwdir}/addressbook
%files bookmarks
%defattr(-,root,root)
%{egwdir}/bookmarks
%files calendar
%defattr(-,root,root)
%{egwdir}/calendar
%files developer_tools
%defattr(-,root,root)
%{egwdir}/developer_tools
%files egw-pear
%defattr(-,root,root)
%{egwdir}/egw-pear
%files emailadmin
%defattr(-,root,root)
%{egwdir}/emailadmin
%files felamimail
%defattr(-,root,root)
%{egwdir}/felamimail
%files filemanager
%defattr(-,root,root)
%{egwdir}/filemanager
%files gallery
%defattr(-,root,root)
%{egwdir}/gallery
%files infolog
%defattr(-,root,root)
%{egwdir}/infolog
%files importexport
%defattr(-,root,root)
%{egwdir}/importexport
%files manual
%defattr(-,root,root)
%{egwdir}/manual
%files news_admin
%defattr(-,root,root)
%{egwdir}/news_admin
%files notifications
%defattr(-,root,root)
%{egwdir}/notifications
%files phpbrain
%defattr(-,root,root)
%{egwdir}/phpbrain
%files phpfreechat
%defattr(-,root,root)
%{egwdir}/phpfreechat
%files phpsysinfo
%defattr(-,root,root)
%{egwdir}/phpsysinfo
%files polls
%defattr(-,root,root)
%{egwdir}/polls
%files projectmanager
%defattr(-,root,root)
%{egwdir}/projectmanager
%files registration
%defattr(-,root,root)
%{egwdir}/registration
%files resources
%defattr(-,root,root)
%{egwdir}/resources
%files sambaadmin
%defattr(-,root,root)
%{egwdir}/sambaadmin
%files sitemgr
%defattr(-,root,root)
%{egwdir}/sitemgr
%files syncml
%defattr(-,root,root)
%{egwdir}/syncml
%files timesheet
%defattr(-,root,root)
%{egwdir}/timesheet
%files tracker
%defattr(-,root,root)
%{egwdir}/tracker
%files wiki
%defattr(-,root,root)
%{egwdir}/wiki

492
doc/rpm-build/post_install.php Executable file
View File

@ -0,0 +1,492 @@
#!/usr/bin/php
<?php
/**
* eGroupWare - RPM post install: automatic install or update EGroupware
*
* @link http://www.egroupware.org
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @author RalfBecker@outdoor-training.de
* @version $Id$
*/
if (isset($_SERVER['HTTP_HOST'])) // security precaution: forbit calling post_install as web-page
{
die('<h1>rpm_post_install.php must NOT be called as web-page --> exiting !!!</h1>');
}
$verbose = false;
$config = array(
'php' => '/usr/bin/php',
'source_dir' => '/usr/share/egroupware',
'data_dir' => '/var/lib/egroupware',
'header' => '$data_dir/header.inc.php', // symlinked to source_dir by rpm
'setup-cli' => '$source_dir/setup/setup-cli.php',
'domain' => 'default',
'config_user' => 'admin',
'config_passwd' => randomstring(),
'db_type' => 'mysql',
'db_host' => 'localhost',
'db_port' => 3306,
'db_name' => 'egroupware',
'db_user' => 'egroupware',
'db_pass' => randomstring(),
'db_grant_host' => 'localhost',
'db_root' => 'root', // mysql root user/pw to create database
'db_root_pw' => '',
'backup' => '',
'admin_user' => 'sysop',
'admin_passwd'=> randomstring(),
'lang' => 'en', // languages for admin user and extra lang to install
'charset' => 'utf-8',
'start_db' => '/sbin/service mysqld',
'autostart_db' => '/sbin/chkconfig --level 345 mysqld on',
'start_webserver' => '/sbin/service httpd',
'autostart_webserver' => '/sbin/chkconfig --level 345 httpd on',
'distro' => 'rh',
'account-auth' => 'sql',
'account_min_id' => '',
'ldap_suffix' => 'dc=local',
'ldap_host' => 'localhost',
'ldap_admin' => 'cn=admin,$suffix',
'ldap_admin_pw' => '',
'ldap_base' => 'o=$domain,$suffix',
'ldap_root_dn' => 'cn=admin,$base',
'ldap_root_pw' => randomstring(),
'ldap_context' => 'ou=accounts,$base',
'ldap_search_filter' => '(uid=%user)',
'ldap_group_context' => 'ou=groups,$base',
'mailserver' => '',
'smtpserver' => 'localhost,25',
'postfix' => '', // see setup-cli.php --help config
'cyrus' => '',
'sieve' => '',
);
// read language from LANG enviroment variable
if (($lang = isset($_ENV['LANG']) ? $_ENV['LANG'] : $_SERVER['LANG']))
{
@list($lang,$nat) = preg_split('/[_.]/',$lang);
if (in_array($lang.'-'.strtolower($nat),array('es-es','pt-br','zh-tw')))
{
$lang .= '-'.strtolower($nat);
}
$config['lang'] = $lang;
}
$config['source_dir'] = dirname(dirname(dirname(__FILE__)));
/**
* Set distribution spezific defaults
*
* @param string $distro=null default autodetect
*/
function set_distro_defaults($distro=null)
{
global $config;
if (is_null($distro))
{
$distro = file_exists('/etc/SuSE-release') ? 'suse' : (file_exists('/etc/debian_version') ? 'debian' :
(file_exists('/etc/mandriva-release') ? 'mandriva' : 'rh'));
}
switch (($config['distro'] = $distro))
{
case 'suse':
$config['php'] = '/usr/bin/php5';
$config['start_db'] = '/sbin/service mysql';
$config['autostart_db'] = '/sbin/chkconfig --level 345 mysql on';
$config['start_webserver'] = '/sbin/service apache2';
$config['autostart_webserver'] = '/sbin/chkconfig --level 345 apache2 on';
$config['ldap_suffix'] = 'dc=site';
$config['ldap_admin'] = $config['ldap_root_dn'] = 'cn=Administrator,$suffix';
$config['ldap_root_pw'] = '$admin_pw';
$config['ldap_base'] = '$suffix';
$config['ldap_context'] = 'ou=people,$base';
$config['ldap_group_context'] = 'ou=group,$base';
break;
case 'debian':
// service not in Debian5, only newer Ubuntu, which complains about /etc/init.d/xx
if (file_exists('/usr/sbin/service'))
{
$config['start_db'] = '/usr/sbin/service mysql';
$config['start_webserver'] = '/usr/sbin/service apache2';
}
else
{
$config['start_db'] = '/etc/init.d/mysql';
$config['start_webserver'] = '/etc/init.d/apache2';
}
$config['autostart_db'] = '/usr/sbin/update-rc.d mysql defaults';
$config['autostart_webserver'] = '/usr/sbin/update-rc.d apache2 defaults';
break;
case 'mandriva':
$config['ldap_suffix'] = 'dc=site';
$config['ldap_admin'] = $config['ldap_root_dn'] = 'uid=LDAP Admin,ou=System Accounts,$suffix';
$config['ldap_root_pw'] = '$admin_pw';
$config['ldap_base'] = '$suffix';
$config['ldap_context'] = 'ou=People,$base';
$config['ldap_group_context'] = 'ou=Group,$base';
break;
default:
$config['distro'] = 'rh';
// fall through
case 'rh': // nothing to do, defaults are already set
break;
}
}
set_distro_defaults();
// read config from command line
$argv = $_SERVER['argv'];
$prog = array_shift($argv);
// check if we have EGW_POST_INSTALL set and prepend it to the command line (command line has precedence)
if (($config_set = isset($_ENV['EGW_POST_INSTALL']) ? $_ENV['EGW_POST_INSTALL'] : @$_SERVER['EGW_POST_INSTALL']))
{
$conf = array();
$config_set = preg_split('/[ \t]+/',trim($config_set));
while($config_set)
{
$val = array_shift($config_set);
if (($quote = $val[0]) == "'" || $quote == '"') // arguments might be quoted with ' or "
{
while (substr($val,-1) != $quote)
{
if (!$config_set) throw new Exception('Invalid EGW_POST_INSTALL enviroment variable!');
$val .= ' '.array_shift($config_set);
}
$val = substr($val,1,-1);
}
$conf[] = $val;
}
$argv = array_merge($conf,$argv);
}
$auth_type_given = false;
while(($arg = array_shift($argv)))
{
if ($arg == '-v' || $arg == '--verbose')
{
$verbose = true;
}
elseif($arg == '-h' || $arg == '--help')
{
usage();
}
elseif($arg == '--suse')
{
set_distro_defaults('suse');
}
elseif($arg == '--distro')
{
set_distro_defaults(array_shift($argv));
}
elseif(substr($arg,0,2) == '--' && isset($config[$name=substr($arg,2)]))
{
$config[$name] = array_shift($argv);
switch($name)
{
case 'auth_type':
$auth_type_given = true;
break;
case 'account_repository': // auth-type defaults to account-repository
if (!$auth_type_given)
{
$config['auth_type'] = $config[$name];
}
break;
}
}
else
{
usage("Unknown argument '$arg'!");
}
}
$replace = array();
foreach($config as $name => $value)
{
$replace['$'.$name] = $value;
if (strpos($value,'$') !== false)
{
$config[$name] = strtr($value,$replace);
}
}
// basic config checks
foreach(array('php','source_dir','data_dir','setup-cli') as $name)
{
if (!file_exists($config[$name])) bail_out(1,$config[$name].' not found!');
}
$setup_cli = $config['php'].' -d memory_limit=64M '.$config['setup-cli'];
if (!file_exists($config['header']) || filesize($config['header']) < 200) // default header redirecting to setup is 147 bytes
{
// --> new install
$extra_config = '';
// check for localhost if database server is started and start it (permanent) if not
if ($config['db_host'] == 'localhost' && $config['start_db'])
{
if (exec($config['start_db'].' status',$dummy,$ret) && $ret)
{
system($config['start_db'].' start');
system($config['autostart_db']);
}
}
// create database
$setup_db = $setup_cli.' --setup-cmd-database sub_command=create_db';
foreach(array('domain','db_type','db_host','db_port','db_name','db_user','db_pass','db_root','db_root_pw','db_grant_host') as $name)
{
$setup_db .= ' '.escapeshellarg($name.'='.$config[$name]);
}
run_cmd($setup_db);
// check if ldap is required and initialise it
// we need to specify account_repository and auth_type to --install as extra config, otherwise install happens for sql!
@list($config['account_repository'],$config['auth_type'],$rest) = explode(',',$config['account-auth'],3);
$extra_config .= ' '.escapeshellarg('account_repository='.$config['account_repository']);
$extra_config .= ' '.escapeshellarg('auth_type='.(empty($config['auth_type']) ? $config['account_repository'] : $config['auth_type']));
if (empty($rest)) unset($config['account-auth']);
if ($config['account_repository'] == 'ldap' || $config['auth_type'] == 'ldap')
{
// set account_min_id to 1100 if not specified to NOT clash with system accounts
$extra_config .= ' '.escapeshellarg('account_min_id='.(!empty($config['account_min_id']) ? $config['account_min_id'] : 1100));
$setup_ldap = $setup_cli.' --setup-cmd-ldap sub_command='.
($config['account_repository'] == 'ldap' ? 'create_ldap' : 'test_ldap');
foreach(array(
'domain','ldap_suffix','ldap_host','ldap_admin','ldap_admin_pw', // non-egw params: only used for create
'ldap_base','ldap_root_dn','ldap_root_pw','ldap_context','ldap_search_filter','ldap_group_context', // egw params
) as $name)
{
if (strpos($value=$config[$name],'$') !== false)
{
$config[$name] = $value = strtr($value,array(
'$suffix' => $config['ldap_suffix'],
'$base' => $config['ldap_base'],
'$admin_pw' => $config['ldap_admin_pw'],
));
}
$setup_ldap .= ' '.escapeshellarg($name.'='.$value);
if (!in_array($name,array('domain','ldap_suffix','ldap_admin','ldap_admin_pw')))
{
$extra_config .= ' '.escapeshellarg($name.'='.$value);
}
}
run_cmd($setup_ldap);
}
// create header
$setup_header = $setup_cli.' --create-header '.escapeshellarg($config['config_passwd'].','.$config['config_user']).
' --domain '.escapeshellarg($config['domain'].','.$config['db_name'].','.$config['db_user'].','.$config['db_pass'].
','.$config['db_type'].','.$config['db_host'].','.$config['db_port']);
run_cmd($setup_header);
// install egroupware
$setup_install = $setup_cli.' --install '.escapeshellarg($config['domain'].','.$config['config_user'].','.$config['config_passwd'].','.$config['backup'].','.$config['charset'].','.$config['lang'])
.$extra_config;
run_cmd($setup_install);
if ($config['data_dir'] != '/var/lib/egroupware')
{
// set files dir different from default
$setup_config = $setup_cli.' --config '.escapeshellarg($config['domain'].','.$config['config_user'].','.$config['config_passwd']).
' --files-dir '.escapeshellarg($config['data_dir'].'/files').' --backup-dir '.escapeshellarg($config['data_dir'].'/backup');
run_cmd($setup_config);
}
// create mailserver config (fmail requires at least minimal config given as default, otherwise fatal error)
$setup_mailserver = $setup_cli.' --config '.escapeshellarg($config['domain'].','.$config['config_user'].','.$config['config_passwd']);
foreach(array('account-auth','smtpserver','postfix','mailserver','cyrus','sieve') as $name)
{
if (!empty($config[$name])) $setup_mailserver .= ' --'.$name.' '.escapeshellarg($config[$name]);
}
run_cmd($setup_mailserver);
// create first user
$setup_admin = $setup_cli.' --admin '.escapeshellarg($config['domain'].','.$config['config_user'].','.$config['config_passwd'].','.
$config['admin_user'].','.$config['admin_passwd'].',,,,'.$config['lang']);
run_cmd($setup_admin);
// check if webserver is started and start it (permanent) if not
if ($config['start_webserver'])
{
if (exec($config['start_webserver'].' status',$dummy,$ret) && $ret)
{
system($config['start_webserver'].' start');
system($config['autostart_webserver']);
}
else
{
system($config['start_webserver'].' reload');
}
}
echo "\n";
echo "EGroupware successful installed\n";
echo "===============================\n";
echo "\n";
echo "Please note the following user names and passwords:\n";
echo "\n";
echo "Setup username: $config[config_user]\n";
echo " password: $config[config_passwd]\n";
echo "\n";
echo "EGroupware username: $config[admin_user]\n";
echo " password: $config[admin_passwd]\n";
echo "\n";
echo "You can log into EGroupware by pointing your browser to http://localhost/egroupware/\n";
echo "Please replace localhost with the appropriate hostname, if you connect remote.\n\n";
if (empty($config['db_root_pw']))
{
echo "*** Database has no root password set, please fix that immediatly: mysqladmin -u root password NEWPASSWORD\n\n";
}
}
else
{
// --> existing install --> update
// get user from header and replace password, as we dont know it
$old_password = patch_header($config['header'],$config['config_user'],$config['config_passwd']);
// register a shutdown function to put old password back in any case
register_shutdown_function('patch_header',$config['header'],$config['config_user'],$old_password);
// update egroupware
$setup_update = $setup_cli.' --update '.escapeshellarg('all,'.$config['config_user'].','.$config['config_passwd']);
$ret = run_cmd($setup_update,$output,array(4,15));
switch($ret)
{
case 4: // header needs an update
$header_update = $setup_cli.' --update-header '.escapeshellarg($config['config_passwd'].','.$config['config_user']);
run_cmd($header_update);
$ret = run_cmd($setup_update,$output,15);
if ($ret != 15) break;
// fall through
case 15: // missing configuration (eg. mailserver)
if (!$verbose) echo implode("\n",(array)$output)."\n";
break;
case 0:
echo "\nEGroupware successful updated\n";
break;
}
exit($ret);
}
/**
* Patches a given password (for header admin) into the EGroupware header.inc.php and returns the old one
*
* @param string $filename
* @param string &$user username on return(!)
* @param string $password new password
* @return string old password
*/
function patch_header($filename,&$user,$password)
{
$header = file_get_contents($filename);
if (!preg_match('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_user'] = '")."([^']+)';/m",$header,$umatches) ||
!preg_match('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_password'] = '")."([^']*)';/m",$header,$pmatches))
{
bail_out(99,"$filename is no regular EGroupware header.inc.php!");
}
file_put_contents($filename,preg_replace('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_password'] = '")."([^']*)';/m",
"\$GLOBALS['egw_info']['server']['header_admin_password'] = '".$password."';",$header));
$user = $umatches[1];
return $pmatches[1];
}
/**
* Runs given shell command, exists with error-code after echoing the output of the failed command (if not already running verbose)
*
* @param string $cmd
* @param array &$output=null $output of command
* @param int|array $no_bailout=null exit code(s) to NOT bail out
* @return int exit code of $cmd
*/
function run_cmd($cmd,array &$output=null,$no_bailout=null)
{
global $verbose;
if ($verbose)
{
echo $cmd."\n";
system($cmd,$ret);
}
else
{
$output[] = $cmd;
exec($cmd,$output,$ret);
}
if ($ret && !in_array($ret,(array)$no_bailout))
{
bail_out($ret,$verbose?null:$output);
}
return $ret;
}
/**
* Stop programm execution with a given exit code and optional extra message
*
* @param int $ret=1
* @param array|string $output line(s) to output before temination notice
*/
function bail_out($ret=1,$output=null)
{
if ($output) echo implode("\n",(array)$output);
echo "\n\nInstallation failed --> exiting!\n\n";
exit($ret);
}
/**
* Return a rand string, eg. to generate passwords
*
* @param int $len=16
* @return string
*/
function randomstring($len=16)
{
static $usedchars = array(
'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f',
'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
'w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L',
'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
'@','!','$','%','&','/','(',')','=','?',';',':','#','_','-','<',
'>','|','{','[',']','}', // dont add \,'" as we have problems dealing with them
);
$str = '';
for($i=0; $i < $len; $i++)
{
$str .= $usedchars[mt_rand(0,count($usedchars)-1)];
}
return $str;
}
/**
* Give usage information and an optional error-message, before stoping program execution with exit-code 90 or 0
*
* @param string $error=null optional error-message
*/
function usage($error=null)
{
global $prog,$config;
echo "Usage: $prog [-h|--help] [-v|--verbose] [--distro=(suse|rh|debian)] [options, ...]\n\n";
echo "options and their defaults:\n";
foreach($config as $name => $default)
{
if (in_array($name,array('config_passwd','db_pass','admin_passwd','ldap_root_pw')))
{
$default = '<16 char random string>';
}
echo '--'.str_pad($name,20).$default."\n";
}
if ($error)
{
echo "$error\n\n";
exit(90);
}
exit(0);
}