"- allow to use config vars in config vars, eg. 'header' => '$data_dir/header.inc.php'

- use LANG from $_SERVER, if not set in $_ENV (happens somehow on openSUSE)"
This commit is contained in:
Ralf Becker 2009-06-01 21:09:40 +00:00
parent 3e34a66a23
commit 8c107c735e
2 changed files with 16 additions and 5 deletions

View File

@ -20,13 +20,13 @@ Prefix: /usr/share
%define php php5 %define php php5
%define extra_requires apache2 apache2-mod_php5 php_any_db php5-dom %define extra_requires apache2 apache2-mod_php5 php_any_db php5-dom
%define cron cron %define cron cron
%define rpm_post_install /usr/bin/php5 %{egwdir}/doc/rpm-build/rpm_post_install.php --php /usr/bin/php5 --start_db /etc/init.d/mysql --autostart_db /sbin/chkconfig --level 3 mysql on --start_webserver /etc/init.d/apache2 --autostart_webserver /sbin/chkconfig --level 3 apache2 on %define rpm_post_install /usr/bin/php5 %{egwdir}/doc/rpm-build/rpm_post_install.php --source_dir %{egwdir} --php /usr/bin/php5 --start_db /etc/init.d/mysql --autostart_db /sbin/chkconfig --level 3 mysql on --start_webserver /etc/init.d/apache2 --autostart_webserver /sbin/chkconfig --level 3 apache2 on
%else %else
%define php php %define php php
%define httpdconfd /etc/httpd/conf.d %define httpdconfd /etc/httpd/conf.d
%define source5 egroupware_fedora.tar.bz2 %define source5 egroupware_fedora.tar.bz2
%define cron crontabs %define cron crontabs
%define rpm_post_install /usr/bin/php %{egwdir}/doc/rpm-build/rpm_post_install.php %define rpm_post_install /usr/bin/php %{egwdir}/doc/rpm-build/rpm_post_install.php --source_dir %{egwdir}
%endif %endif
%if 0%{?fedora_version} %if 0%{?fedora_version}
%define osversion %{?fedora_version} %define osversion %{?fedora_version}

View File

@ -18,8 +18,8 @@ $config = array(
'php' => '/usr/bin/php', 'php' => '/usr/bin/php',
'source_dir' => '/usr/share/egroupware', 'source_dir' => '/usr/share/egroupware',
'data_dir' => '/var/lib/egroupware', 'data_dir' => '/var/lib/egroupware',
'header' => '/var/lib/egroupware/header.inc.php', // symlinked to source_dir by rpm 'header' => '$data_dir/header.inc.php', // symlinked to source_dir by rpm
'setup-cli' => '/usr/share/egroupware/setup/setup-cli.php', 'setup-cli' => '$source_dir/setup/setup-cli.php',
'domain' => 'default', 'domain' => 'default',
'config_user' => 'admin', 'config_user' => 'admin',
'config_passwd' => randomstring(), 'config_passwd' => randomstring(),
@ -42,8 +42,9 @@ $config = array(
'start_webserver' => '/etc/init.d/httpd', 'start_webserver' => '/etc/init.d/httpd',
'autostart_webserver' => '/sbin/chkconfig --level 3 httpd on', 'autostart_webserver' => '/sbin/chkconfig --level 3 httpd on',
); );
// read language from LANG enviroment variable // read language from LANG enviroment variable
if (($lang = $_ENV['LANG'])) if (($lang = isset($_ENV['LANG']) ? $_ENV['LANG'] : $_SERVER['LANG']))
{ {
list($lang,$nat) = split('[_.]',$lang); list($lang,$nat) = split('[_.]',$lang);
if (in_array($lang.'-'.strtolower($nat),array('es-es','pt-br','zh-tw'))) if (in_array($lang.'-'.strtolower($nat),array('es-es','pt-br','zh-tw')))
@ -75,6 +76,16 @@ while(($arg = array_shift($argv)))
usage("Unknown argument '$arg'!"); 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 // basic config checks
foreach(array('php','source_dir','data_dir','setup-cli') as $name) foreach(array('php','source_dir','data_dir','setup-cli') as $name)
{ {