Work on rpm packages

This commit is contained in:
Laurent Destailleur 2011-08-14 21:25:25 +00:00
parent af88775b2b
commit ec0f245e39
3 changed files with 52 additions and 7 deletions

View File

@ -2,7 +2,7 @@
#----------------------------------------------------------------------------
# \file build/makepack-dolibarr.pl
# \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps)
# \version $Id: makepack-dolibarr.pl,v 1.146 2011/08/14 19:40:30 eldy Exp $
# \version $Id: makepack-dolibarr.pl,v 1.147 2011/08/14 21:25:26 eldy Exp $
# \author (c)2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
#----------------------------------------------------------------------------
@ -45,7 +45,7 @@ if (-d "/usr/src/RPM") { $RPMDIR="/usr/src/RPM"; } # mandrake
use vars qw/ $REVISION $VERSION /;
$REVISION='$Revision: 1.146 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
$REVISION='$Revision: 1.147 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
$VERSION="3.2 (build $REVISION)";
@ -515,12 +515,16 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$FILENAMETGZ2/usr/share/$PROJECT/htdocs/htdocs/theme/bureau2crea`;
# Conf files
print "Copy apache.conf file into $BUILDROOT/$FILENAMETGZ2/etc/$PROJECT/httpd-dolibarr.conf\n";
print "Copy config files into $BUILDROOT/$FILENAMETGZ2/etc/$PROJECT\n";
$ret=`mkdir -p "$BUILDROOT/$FILENAMETGZ2/etc/$PROJECT"`;
$ret=`cp "$SOURCE/build/rpm/httpd-dolibarr.conf" "$BUILDROOT/$FILENAMETGZ2/etc/$PROJECT/apache.conf"`;
$ret=`cp "$SOURCE/build/rpm/file_contexts.dolibarr" "$BUILDROOT/$FILENAMETGZ2/etc/$PROJECT/file_contexts.dolibarr"`;
$ret=`cp "$SOURCE/build/rpm/conf.php" "$BUILDROOT/$FILENAMETGZ2/etc/$PROJECT/conf.php"`;
$ret=`cp "$SOURCE/build/rpm/install.forced.php.install" "$BUILDROOT/$FILENAMETGZ2/etc/$PROJECT/install.forced.php"`;
$installfile="install.forced.php.generic";
if ($target =~ /FEDO/i) { $installfile="install.forced.php.fedora"; }
if ($target =~ /MAND/i) { $installfile="install.forced.php.mandriva"; }
if ($target =~ /OPEN/i) { $installfile="install.forced.php.opensuse"; }
#$ret=`cp "$SOURCE/build/rpm/$installfile" "$BUILDROOT/$FILENAMETGZ2/etc/$PROJECT/install.forced.php"`;
# Set owners
print "Set owners on files/dir\n";

View File

@ -212,7 +212,7 @@ then
superuserpassword=$(/bin/grep --max-count=1 "password" %{_sysconfdir}/mysql/debian.cnf | /bin/sed -e 's/^password[ =]*//g')
fi
echo Mysql superuser found to use is $superuserlogin
%{__cat} /usr/share/dolibarr/build/rpm/install.forced.php.install | sed -e 's/__SUPERUSERLOGIN__/'$superuserlogin'/g' | sed -e 's/__SUPERUSERPASSWORD__/'$superuserpassword'/g' > $installconfig
%{__cat} /usr/share/dolibarr/build/rpm/install.forced.php.generic | sed -e 's/__SUPERUSERLOGIN__/'$superuserlogin'/g' | sed -e 's/__SUPERUSERPASSWORD__/'$superuserpassword'/g' > $installconfig
%{__chmod} -R 660 $installconfig
fi

View File

@ -23,7 +23,7 @@
* \file htdocs/install/etape1.php
* \ingroup install
* \brief Build conf file on disk
* \version $Id: etape1.php,v 1.138 2011/08/14 17:17:19 eldy Exp $
* \version $Id: etape1.php,v 1.139 2011/08/14 21:25:26 eldy Exp $
*/
define('DONOTLOADCONF',1); // To avoid loading conf by file inc.php
@ -235,7 +235,8 @@ if ($action == "set")
/**
* Write main.inc.php and master.inc.php into documents dir
*/
// TODO
$error+=write_main_file($main_data_dir.'/main.inc.php',$main_dir);
$error+=write_master_file($main_data_dir.'/master.inc.php',$main_dir);
/**
* Create database and admin user database
@ -521,6 +522,46 @@ dolibarr_install_syslog("--- install/etape1.php end", LOG_INFO);
pFooter($error,$setuplang,'jsinfo');
/**
* Create main file. No particular permissions are set by installer.
*
* @param mainfile Path to conf file to generate/update
*/
function write_main_file($mainfile,$main_dir)
{
$fp = fopen("$mainfile", "w");
if($fp)
{
clearstatcache();
fputs($fp, '<?php'."\n");
fputs($fp, "# Wrapper to include main into htdocs\n");
fputs($fp, "include_once('".$main_dir."/main.inc.php');\n");
fputs($fp, '?>');
fclose($fp);
}
}
/**
* Create master file. No particular permissions are set by installer.
*
* @param masterfile Path to conf file to generate/update
*/
function write_master_file($masterfile,$main_dir)
{
$fp = fopen("$masterfile", "w");
if($fp)
{
clearstatcache();
fputs($fp, '<?php'."\n");
fputs($fp, "# Wrapper to include master into htdocs\n");
fputs($fp, "include_once('".$main_dir."/master.inc.php');\n");
fputs($fp, '?>');
fclose($fp);
}
}
/**
* Save configuration file. No particular permissions are set by installer.
*