Work on packages

This commit is contained in:
Laurent Destailleur 2011-06-26 11:41:50 +00:00
parent d2916ffb1e
commit a484de3770
6 changed files with 100 additions and 47 deletions

View File

@ -1,7 +1,7 @@
<!-- Application namespaces and APS version (step 9) --> <!-- Application namespaces and APS version (step 9) -->
<application xmlns="http://apstandard.com/ns/1" version="1.1"> <application xmlns="http://apstandard.com/ns/1" version="1.1">
<!-- Application common properties (step 9) --> <!-- Application common properties (step 9) -->
<name>Dolibarr</name> <name>Dolibarr ERP-CRM</name>
<version>__VERSION__</version> <version>__VERSION__</version>
<release>__RELEASE__</release> <release>__RELEASE__</release>
<homepage>http://www.dolibarr.org/</homepage> <homepage>http://www.dolibarr.org/</homepage>
@ -13,10 +13,10 @@
<packager> <packager>
<name>Laurent Destailleur</name> <name>Laurent Destailleur</name>
<homepage>http://www.nltechno.com</homepage> <homepage>http://www.nltechno.com</homepage>
<uri>uuid:714f0a7b-85d6-4eb8-b68e-40f9acbb3103</uri> <uri>uuid:e743ee30-9fe8-11e0-a32e-0025115d642c</uri>
</packager> </packager>
<presentation> <presentation>
<summary>Dolibarr ERP - CRM, the easy to use software to manage small or medium companies, freelancers or foundations</summary> <summary>Dolibarr ERP-CRM, the easy to use software to manage small or medium companies, freelancers or foundations</summary>
<description> <description>
Dolibarr is a free modular software (you see only Dolibarr is a free modular software (you see only
features you need) to manage small and medium companies, freelancers features you need) to manage small and medium companies, freelancers
@ -71,6 +71,7 @@ standalone software. Dolibarr is designed to provide simplicity to end-user.
</presentation> </presentation>
<!-- Service settings (step 7) --> <!-- Service settings (step 7) -->
<settings> <settings>
<!--
<group> <group>
<name>Administrator's preferences</name> <name>Administrator's preferences</name>
<setting id="admin_name" type="string" default-value="admin" <setting id="admin_name" type="string" default-value="admin"
@ -84,6 +85,7 @@ Please make sure the text you entered starts with a letter and continues with ei
<name>Password</name> <name>Password</name>
</setting> </setting>
</group> </group>
-->
</settings> </settings>
<!-- Service used technologies (step 6) --> <!-- Service used technologies (step 6) -->
<requirements xmlns:php="http://apstandard.com/ns/1/php" <requirements xmlns:php="http://apstandard.com/ns/1/php"

View File

@ -14,7 +14,7 @@
<packager> <packager>
<name>Laurent Destailleur</name> <name>Laurent Destailleur</name>
<homepage>http://www.nltechno.com</homepage> <homepage>http://www.nltechno.com</homepage>
<uri>uuid:714f0a7b-85d6-4eb8-b68e-40f9acbb3103</uri> <uri>uuid:e743ee30-9fe8-11e0-a32e-0025115d642c</uri>
</packager> </packager>
<presentation> <presentation>
<summary>Dolibarr ERP - CRM, the easy to use software to manage small or medium companies, freelancers or foundations</summary> <summary>Dolibarr ERP - CRM, the easy to use software to manage small or medium companies, freelancers or foundations</summary>

View File

@ -5,56 +5,52 @@
// This is list of predefined languages when script is ran. // This is list of predefined languages when script is ran.
// We set them manually for test purpose // We set them manually for test purpose
putenv("SETTINGS_admin_name")='admin'; putenv('SETTINGS_admin_name=admin');
putenv("SETTINGS_admin_password")='admin-ad'; putenv('SETTINGS_admin_password=admin-ad');
putenv("BASE_URL_SCHEME")='http'; putenv('BASE_URL_SCHEME=http');
putenv("BASE_URL_HOST")='localhost'; putenv('BASE_URL_HOST=localhost');
putenv("BASE_URL_PORT")=80; putenv('BASE_URL_PORT=0');
putenv("BASE_URL_PATH")='/'; putenv('BASE_URL_PATH=/');
putenv("WEB___DIR")='/var/wwww/dolibarr'; //putenv('WEB___DIR=/var/wwww/dolibarr/htdocs'); // WEB___DIR is dir to htdocs
putenv("DB_main_NAME")='dolibarr'; putenv('WEB___DIR=../htdocs'); // WEB___DIR is dir to htdocs
putenv("DB_main_HOST")='localhost'; putenv('DB_main_NAME=dolibarr');
putenv("DB_main_PORT")='3306'; putenv('DB_main_HOST=localhost');
putenv("DB_main_LOGIN")='root'; putenv('DB_main_PORT=3306');
putenv("DB_main_PASSWORD")='root'; putenv('DB_main_LOGIN=root');
putenv('DB_main_PASSWORD=root');
// Check parameters
if(count($_SERVER['argv']) < 2) if(count($_SERVER['argv']) < 2)
{ {
print "Usage: configure (install | upgrade <version> | configure | remove)\n"; print "Usage: configure.php (install | upgrade <version> | configure | remove)\n";
exit(1); exit(1);
} }
$command = $_SERVER['argv'][1]; //$command stores the argument with which the script was invoked.
$command = $_SERVER['argv'][1];
//$command stores the argument with which the script was invoked.
if($command == "install") if($command == "install")
{ {
$db_id = 'main'; $db_id = 'main';
$rootdir = getenv("WEB___DIR"); $rootdir = getenv("WEB___DIR");
$datadir = getenv("WEB___DIR").'/dolibarr_documents'; if ($rootdir != '/') $rootdir = preg_replace('/\/$/','',$rootdir); // Remove last /
$datadir = $rootdir.'/dolibarr_documents';
//List of database-related variables that are passed to the configuration //List of database-related variables that are passed to the configuration
//script. See the 6.3.1.1.1. Environment variables section of the //script. See the 6.3.1.1.1. Environment variables section of the
//Specification for details. //Specification for details.
$db_address = getenv("DB_${db_id}_HOST"); $db_address = getenv("DB_${db_id}_HOST");
$db_port = getenv("DB_${db_id}_PORT");
/*if (fetch_env_var("DB_${db_id}_PORT") !== False)
$db_address .= ':' . fetch_env_var("DB_${db_id}_PORT");
*/
$dblogin = getenv("DB_${db_id}_LOGIN"); $dblogin = getenv("DB_${db_id}_LOGIN");
$dbpassword = getenv("DB_${db_id}_PASSWORD"); $dbpassword = getenv("DB_${db_id}_PASSWORD");
$dbname = getenv("DB_${db_id}_NAME"); $dbname = getenv("DB_${db_id}_NAME");
//PHP functions for connecting to the mysql server and //PHP functions for connecting to the mysql server and
//executing SQL queries. //executing SQL queries.
//mysql_connect($dbaddress, $dblogin, $dbpassword); //mysql_connect($dbaddress, $dblogin, $dbpassword);
//mysql_select_db($dbname); //mysql_select_db($dbname);
/* /*
$sql_queries = file($query_file); $sql_queries = file($query_file);
foreach ($sql_queries as $query) mysql_query($query); foreach ($sql_queries as $query) mysql_query($query);
@ -64,29 +60,58 @@ if($command == "install")
//Other code to be executed on invoking configure with //Other code to be executed on invoking configure with
//the install argument. //the install argument.
// Create document directories // Create empty config file
print "Create directory ".$datadir.'/dolibarr_documents'."\n"; $file=$rootdir.'/conf/conf.php';
mkdir($datadir.'/dolibarr_documents'); print "Create conf file ".$file."\n";
$fp = fopen($file, 'wb');
if ($fp)
{
fclose($fp);
chmod($file,0775);
}
else
{
print "configure.php install: Unable to write file $file.\n";
exit(1);
}
// Create install.forced.php // Create empty directory that will be used by software to store uploaded documents
print "Create file ".$rootdir.'/install/install.forced.php'."\n"; print "Create directory ".$datadir."\n";
$file_source='build/aps/install.forced.php.install'; @mkdir($datadir);
chmod($datadir,0775);
// Create install.forced.php into htdocs/install directory with value.
// This will set parameters of install for web installer wizard.
$file_source=$rootdir.'/../build/aps/install.forced.php.install';
$file=$rootdir.'/install/install.forced.php'; $file=$rootdir.'/install/install.forced.php';
print "Create file ".$file.' from '.$file_source."\n";
$modify_hash=array(); // TODO Add substitution here $modify_hash=array(
'WEB___DIR'=>$rootdir,
'DB_'.$db_id.'_HOST'=>$db_address,
'DB_'.$db_id.'_PORT'=>$db_port,
'DB_'.$db_id.'_LOGIN'=>$dblogin,
'DB_'.$db_id.'_PASSWORD'=>$dbpassword,
'DB_'.$db_id.'_NAME'=>$dbname
);
$file_content = read_file($file_source); $file_content = fread(fopen($file_source, 'r'), filesize($file_source));
foreach($modify_hash as $param => $val){ foreach($modify_hash as $param => $val){
$file_content = str_replace($param, php_quote($val), $file_content); $file_content = str_replace($param, php_quote($val), $file_content);
} }
$fp = fopen($file, 'wb'); $fp = fopen($file, 'wb');
if (!$fp) if ($fp)
{ {
print "Unable to write file $file.\n"; fputs($fp, $file_content);
exit(1); fputs($fp, "\n");
fclose($fp);
chmod($file,0775);
}
else
{
print "configure.php install: Unable to write file $file.\n";
exit(2);
} }
fputs($fp, $content, strlen($content));
fclose($fp);
exit(0); exit(0);
} }
@ -109,6 +134,18 @@ if($command == "configure")
exit(0); exit(0);
} }
print "Error: unknown command $command.\n"; print "configure.php: Error: unknown command $command.\n";
exit(1); exit(1);
// Content of file-util.php we need
function php_quote($val)
{
$res_val = str_replace("\\", "\\\\", $val);
$res_val = str_replace("'", "\\'", $res_val);
return $res_val;
}
?> ?>

View File

@ -1,7 +1,14 @@
<?php <?php
// File to force Dolibarr wizard installer choices.
//
// This file must be present into htdocs/install directory
// during install process to be used.
//
// $Id: install.forced.php.install,v 1.2 2011/06/26 11:41:50 eldy Exp $
//
$force_install_noedit=1; $force_install_noedit=1;
$force_install_message='KeepDefaultValuesDeb'; $force_install_message='KeepDefaultValuesDeb';
$force_install_main_data_root='WEB___DIR/documents'; $force_install_main_data_root='WEB___DIR/dolibarr_documents';
$force_install_type='mysqli'; $force_install_type='mysqli';
$force_install_dbserver='DB_main_HOST'; $force_install_dbserver='DB_main_HOST';
$force_install_port='DB_main_PORT'; $force_install_port='DB_main_PORT';

View File

@ -1,4 +1,11 @@
<?php <?php
// File to force Dolibarr wizard installer choices.
//
// This file must be present into htdocs/install directory
// during install process to be used.
//
// $Id: install.forced.php.install,v 1.5 2011/06/26 11:41:50 eldy Exp $
//
$force_install_noedit=1; $force_install_noedit=1;
$force_install_message='KeepDefaultValuesDeb'; $force_install_message='KeepDefaultValuesDeb';
$force_install_main_data_root='/usr/share/dolibarr/documents'; $force_install_main_data_root='/usr/share/dolibarr/documents';

View File

@ -2,7 +2,7 @@
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# \file build/makepack-dolibarr.pl # \file build/makepack-dolibarr.pl
# \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps) # \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps)
# \version $Id: makepack-dolibarr.pl,v 1.104 2011/06/25 19:41:36 eldy Exp $ # \version $Id: makepack-dolibarr.pl,v 1.105 2011/06/26 11:41:50 eldy Exp $
# \author (c)2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> # \author (c)2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
@ -48,7 +48,7 @@ if (-d "/usr/src/RPM") {
use vars qw/ $REVISION $VERSION /; use vars qw/ $REVISION $VERSION /;
$REVISION='$Revision: 1.104 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1; $REVISION='$Revision: 1.105 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
$VERSION="1.0 (build $REVISION)"; $VERSION="1.0 (build $REVISION)";
@ -595,8 +595,8 @@ if ($nboftargetok) {
close SPECFROM; close SPECFROM;
close SPECTO; close SPECTO;
print "Version set to $MAJOR.$MINOR.$newbuild\n"; print "Version set to $MAJOR.$MINOR.$newbuild\n";
$cmd="cp -pr \"$BUILDROOT/$PROJECT/build/aps/configure\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/scripts/configure\""; #$cmd="cp -pr \"$BUILDROOT/$PROJECT/build/aps/configure\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/scripts/configure\"";
$ret=`$cmd`; #$ret=`$cmd`;
$cmd="cp -pr \"$BUILDROOT/$PROJECT/build/aps/configure.php\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/scripts/configure.php\""; $cmd="cp -pr \"$BUILDROOT/$PROJECT/build/aps/configure.php\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/scripts/configure.php\"";
$ret=`$cmd`; $ret=`$cmd`;
$cmd="cp -pr \"$BUILDROOT/$PROJECT/doc/images\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/images\""; $cmd="cp -pr \"$BUILDROOT/$PROJECT/doc/images\" \"$BUILDROOT/$PROJECT.tmp/$PROJECT/images\"";