From ec0f245e39ede3d83fe22c5dd1ba3c7d0a4ddd1d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 14 Aug 2011 21:25:25 +0000 Subject: [PATCH] Work on rpm packages --- build/makepack-dolibarr.pl | 12 ++++++--- build/rpm/dolibarr_generic.spec | 2 +- htdocs/install/etape1.php | 45 +++++++++++++++++++++++++++++++-- 3 files changed, 52 insertions(+), 7 deletions(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index d5b19540077..17365cacb40 100644 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -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 #---------------------------------------------------------------------------- @@ -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"; diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index ba75dd5e9c5..e5e862f1e3e 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -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 diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php index 60d24a925ac..313c33d2413 100644 --- a/htdocs/install/etape1.php +++ b/htdocs/install/etape1.php @@ -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, ''); + 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, ''); + fclose($fp); + } +} + + /** * Save configuration file. No particular permissions are set by installer. *