Work on 3.1 packaging
This commit is contained in:
parent
cd67cc9dfe
commit
77b6738053
@ -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.123 2011/07/30 14:56:12 eldy Exp $
|
||||
# \version $Id: makepack-dolibarr.pl,v 1.124 2011/07/31 13:17:03 eldy Exp $
|
||||
# \author (c)2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@ -48,7 +48,7 @@ if (-d "/usr/src/RPM") {
|
||||
|
||||
|
||||
use vars qw/ $REVISION $VERSION /;
|
||||
$REVISION='$Revision: 1.123 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
|
||||
$REVISION='$Revision: 1.124 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
|
||||
$VERSION="1.0 (build $REVISION)";
|
||||
|
||||
|
||||
@ -696,12 +696,12 @@ if ($nboftargetok) {
|
||||
if ($OS =~ /windows/i)
|
||||
{
|
||||
print "Move *_all.deb to $DESTI\n";
|
||||
$ret=`mv "$BUILDROOT/*_all.deb" "$DESTI/"`;
|
||||
$ret=`mv $BUILDROOT/*_all.deb "$DESTI/"`;
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Move *_all.deb to $DESTI\n";
|
||||
$ret=`mv "$BUILDROOT/*_all.deb" "$DESTI/"`;
|
||||
$ret=`mv $BUILDROOT/*_all.deb "$DESTI/"`;
|
||||
}
|
||||
next;
|
||||
}
|
||||
|
||||
@ -138,23 +138,61 @@ rm -rf $RPM_BUILD_ROOT
|
||||
#%config /var/www/dolibarr/htdocs/conf/conf.php
|
||||
|
||||
|
||||
#---- post (after install)
|
||||
#---- post (after unzip during install)
|
||||
%post
|
||||
%update_menus
|
||||
#%update_menus # Does not exists on fedora nor mandriva
|
||||
|
||||
|
||||
# Define vars
|
||||
# Dolibarr files are stored into /var/www
|
||||
export targetdir='/var/www/dolibarr'
|
||||
# Dolibarr uploaded files and generated documents are stored into /usr/share/dolibarr/documents
|
||||
export docdir='/usr/share/dolibarr/documents'
|
||||
# Dolibarr uploaded files and generated documents will be stored into docdir
|
||||
#export docdir="/var/lib/dolibarr/documents"
|
||||
export docdir="/usr/share/dolibarr/documents"
|
||||
export installfileorig="$targetdir/build/rpm/install.forced.php.install"
|
||||
export installconfig="%{_sysconfdir}/dolibarr/install.forced.php"
|
||||
export apachefileorig="$targetdir/build/rpm/httpd-dolibarr.conf"
|
||||
export apacheconfig="%{_sysconfdir}/dolibarr/apache.conf"
|
||||
#config="/usr/share/dolibarr/htdocs/conf/conf.php"
|
||||
config="%{_sysconfdir}/dolibarr/conf.php"
|
||||
lockfile="/usr/share/dolibarr/install.lock"
|
||||
|
||||
|
||||
# Detect OS
|
||||
os='unknown';
|
||||
if [ -d %{_sysconfdir}/httpd/conf.d ]; then
|
||||
export os='fedora-redhat';
|
||||
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
|
||||
export apacheuser='apache';
|
||||
export apachegroup='apache';
|
||||
fi
|
||||
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^wwwrun /etc/passwd | wc -l` -ge 1 ]; then
|
||||
export os='opensuse';
|
||||
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
|
||||
export apacheuser='wwwrun';
|
||||
export apachegroup='www';
|
||||
fi
|
||||
if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then
|
||||
export os='mageia-mandriva';
|
||||
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
|
||||
export apacheuser='apache';
|
||||
export apachegroup='apache';
|
||||
fi
|
||||
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then
|
||||
export os='ubuntu-debian';
|
||||
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
|
||||
export apacheuser='www-data';
|
||||
export apachegroup='www-data';
|
||||
fi
|
||||
echo OS detected: $os
|
||||
|
||||
|
||||
# Create empty directory for uploaded files and generated documents
|
||||
echo Create document directory $docdir
|
||||
mkdir -p $docdir
|
||||
mkdir -p %{_sysconfdir}/dolibarr
|
||||
|
||||
# Create install.forced.php into Dolibarr install directory
|
||||
fileorig="$targetdir/build/rpm/install.forced.php.install"
|
||||
config="$targetdir/htdocs/install/install.forced.php"
|
||||
superuserlogin=''
|
||||
superuserpassword=''
|
||||
if [ -f %{_sysconfdir}/mysql/debian.cnf ] ; then
|
||||
@ -164,72 +202,47 @@ if [ -f %{_sysconfdir}/mysql/debian.cnf ] ; then
|
||||
fi
|
||||
echo Mysql superuser found to use is $superuserlogin
|
||||
if [ -z "$superuserlogin" ] ; then
|
||||
cat $fileorig | sed -e 's/__SUPERUSERLOGIN__/root/g' | sed -e 's/__SUPERUSERPASSWORD__//g' > $config
|
||||
cat $installfileorig | sed -e 's/__SUPERUSERLOGIN__/root/g' | sed -e 's/__SUPERUSERPASSWORD__//g' > $installconfig
|
||||
else
|
||||
cat $fileorig | sed -e 's/__SUPERUSERLOGIN__/'$superuserlogin'/g' | sed -e 's/__SUPERUSERPASSWORD__/'$superuserpassword'/g' > $config
|
||||
cat $installfileorig | sed -e 's/__SUPERUSERLOGIN__/'$superuserlogin'/g' | sed -e 's/__SUPERUSERPASSWORD__/'$superuserpassword'/g' > $installconfig
|
||||
fi
|
||||
chown -R root:$apachegroup $installconfig
|
||||
chmod -R 660 $installconfig
|
||||
|
||||
# Create an empty conf.php with permission to web server
|
||||
if [ ! -f $config ]
|
||||
then
|
||||
echo Create empty file $config
|
||||
touch $config
|
||||
chown -R root:$apachegroup $config
|
||||
chmod -R 660 $config
|
||||
fi
|
||||
|
||||
# Create a config file %{_sysconfdir}/dolibarr/apache.conf
|
||||
if [ ! -f %{_sysconfdir}/dolibarr/apache.conf ]; then
|
||||
echo Create dolibarr web server config file %{_sysconfdir}/dolibarr/apache.conf
|
||||
mkdir -p %{_sysconfdir}/dolibarr
|
||||
cp $targetdir/build/rpm/httpd-dolibarr.conf %{_sysconfdir}/dolibarr/apache.conf
|
||||
chmod a-x %{_sysconfdir}/dolibarr/apache.conf
|
||||
chmod go-w %{_sysconfdir}/dolibarr/apache.conf
|
||||
# Create a config file $apacheconfig
|
||||
if [ ! -f $apacheconfig ]; then
|
||||
echo Create dolibarr web server config file $apacheconfig
|
||||
cp $apachefileorig $apacheconfig
|
||||
chmod a-x $apacheconfig
|
||||
chmod go-w $apacheconfig
|
||||
fi
|
||||
|
||||
|
||||
# Detect OS
|
||||
os='unknown';
|
||||
if [ -d %{_sysconfdir}/httpd/conf.d ]; then
|
||||
export os='fedora-redhat';
|
||||
export conffile="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
|
||||
export apacheuser='apache';
|
||||
export apachegroup='apache';
|
||||
fi
|
||||
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^wwwrun /etc/passwd | wc -l` -ge 1 ]; then
|
||||
export os='opensuse';
|
||||
export conffile="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
|
||||
export apacheuser='wwwrun';
|
||||
export apachegroup='www';
|
||||
fi
|
||||
if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then
|
||||
export os='mageia-mandriva';
|
||||
export conffile="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
|
||||
export apacheuser='apache';
|
||||
export apachegroup='apache';
|
||||
fi
|
||||
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then
|
||||
export os='ubuntu-debian';
|
||||
export conffile="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
|
||||
export apacheuser='www-data';
|
||||
export apachegroup='www-data';
|
||||
fi
|
||||
echo OS detected: $os
|
||||
|
||||
# Create a config link dolibarr.conf for Fedora or Redhat
|
||||
if [ ! -f $conffile ]; then
|
||||
echo Create dolibarr web server config link $conffile
|
||||
ln -fs /etc/dolibarr/apache.conf $conffile
|
||||
if [ ! -f $apachelink ]; then
|
||||
echo Create dolibarr web server config link $apachelink
|
||||
ln -fs $apacheconfig $apachelink
|
||||
fi
|
||||
|
||||
# Set permissions
|
||||
echo Set permission to $apacheuser:$apachegroup on $targetdir
|
||||
chown -R $apacheuser:$apachegroup $targetdir
|
||||
chmod -R a-w $targetdir
|
||||
chmod u+w $targetdir
|
||||
|
||||
echo Set permission to $apacheuser:$apachegroup on $docdir
|
||||
chown -R $apacheuser:$apachegroup $docdir
|
||||
chmod -R o-w $docdir
|
||||
|
||||
# Create empty conf.php file for web installer
|
||||
if [ ! -s $targetdir/htdocs/conf/conf.php ]; then
|
||||
echo Create empty Dolibarr conf.php file
|
||||
touch $targetdir/htdocs/conf/conf.php
|
||||
chown $apacheuser:$apachegroup $targetdir/htdocs/conf/conf.php
|
||||
chmod ug+rw $targetdir/htdocs/conf/conf.php
|
||||
fi
|
||||
|
||||
# Set SE Linux on OS SE is enabled
|
||||
if [ "x$os" = "xfedora-redhat" -a -s /usr/bin/chcon ]; then
|
||||
echo Set SELinux permissions
|
||||
# Warning: chcon seems not cumulative
|
||||
@ -237,6 +250,7 @@ if [ "x$os" = "xfedora-redhat" -a -s /usr/bin/chcon ]; then
|
||||
#chcon -R -h -t httpd_sys_content_t $docdir
|
||||
chcon -R -h -t httpd_sys_script_rw_t $targetdir
|
||||
chcon -R -h -t httpd_sys_script_rw_t $docdir
|
||||
chcon -R -h -t httpd_sys_script_rw_t %{_sysconfdir}/dolibarr
|
||||
#chcon -R -h -t httpd_sys_script_exec_t $targetdir
|
||||
fi
|
||||
|
||||
@ -253,57 +267,71 @@ fi
|
||||
echo
|
||||
echo "----- Dolibarr %version - (c) Dolibarr dev team -----"
|
||||
echo "Dolibarr files are now installed (into /var/www/dolibarr)."
|
||||
echo To finish installation and use Dolibarr, call the following
|
||||
echo page from your web browser:
|
||||
echo http://localhost/dolibarr/
|
||||
echo "To finish installation and use Dolibarr, click on ne menu"
|
||||
echo "entry Dolibarr ERP-CRM or call the following page from your"
|
||||
echo "web browser:"
|
||||
echo "http://localhost/dolibarr/"
|
||||
echo "--------------------------------------------------"
|
||||
echo
|
||||
|
||||
|
||||
|
||||
#---- postun (after uninstall)
|
||||
%postun
|
||||
%clean_menus
|
||||
#%clean_menus # Does not exists on fedora nor mandriva
|
||||
|
||||
|
||||
# Define vars
|
||||
# Dolibarr files are stored into targetdir
|
||||
export targetdir='/var/www/dolibarr'
|
||||
# Dolibarr uploaded files and generated documents will be stored into docdir
|
||||
#export docdir="/var/lib/dolibarr/documents"
|
||||
export docdir="/usr/share/dolibarr/documents"
|
||||
export installfileorig="$targetdir/build/rpm/install.forced.php.install"
|
||||
export installconfig="%{_sysconfdir}/dolibarr/install.forced.php"
|
||||
export apachefileorig="$targetdir/build/rpm/httpd-dolibarr.conf"
|
||||
export apacheconfig="%{_sysconfdir}/dolibarr/apache.conf"
|
||||
#config="/usr/share/dolibarr/htdocs/conf/conf.php"
|
||||
config="%{_sysconfdir}/dolibarr/conf.php"
|
||||
lockfile="$targetdir/install.lock"
|
||||
|
||||
|
||||
# Detect OS
|
||||
os='unknown';
|
||||
if [ -d %{_sysconfdir}/httpd/conf.d ]; then
|
||||
export os='fedora-redhat';
|
||||
export conffile="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
|
||||
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
|
||||
export apacheuser='apache';
|
||||
export apachegroup='apache';
|
||||
fi
|
||||
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^wwwrun /etc/passwd | wc -l` -ge 1 ]; then
|
||||
export os='opensuse';
|
||||
export conffile="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
|
||||
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
|
||||
export apacheuser='wwwrun';
|
||||
export apachegroup='www';
|
||||
fi
|
||||
if [ -d %{_sysconfdir}/httpd/conf.d -a `grep -i "^mageia\|mandriva" /etc/issue | wc -l` -ge 1 ]; then
|
||||
export os='mageia-mandriva';
|
||||
export conffile="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
|
||||
export apachelink="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
|
||||
export apacheuser='apache';
|
||||
export apachegroup='apache';
|
||||
fi
|
||||
if [ -d %{_sysconfdir}/apache2/conf.d -a `grep ^www-data /etc/passwd | wc -l` -ge 1 ]; then
|
||||
export os='ubuntu-debian';
|
||||
export conffile="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
|
||||
export apachelink="%{_sysconfdir}/apache2/conf.d/dolibarr.conf"
|
||||
export apacheuser='www-data';
|
||||
export apachegroup='www-data';
|
||||
fi
|
||||
echo OS detected: $os
|
||||
|
||||
# Dolibarr files are stored into /var/www
|
||||
export targetdir='/var/www/dolibarr'
|
||||
# Dolibarr uploaded files and generated documents are stored into /usr/share/dolibarr/documents
|
||||
export docdir='/usr/share/dolibarr/documents'
|
||||
|
||||
if [ -f $conffile ] ;
|
||||
# Remove apache link
|
||||
if [ -f $apachelink ] ;
|
||||
then
|
||||
echo Delete apache config file for Dolibarr
|
||||
rm -f $conffile
|
||||
echo Delete apache config link for Dolibarr
|
||||
rm -f $apachelink
|
||||
status=purge
|
||||
fi
|
||||
|
||||
# Restart web servers if required
|
||||
if [ "x$status" = "xpurge" ] ;
|
||||
then
|
||||
# Restart web server
|
||||
@ -318,9 +346,10 @@ fi
|
||||
|
||||
# Removed dirs after apache restart
|
||||
echo Removed remaining dirs
|
||||
rm -rf /etc/dolibarr
|
||||
rm -rf $targetdir/htdocs/conf
|
||||
rm -rf $targetdir/htdocs/install
|
||||
rm -f $apacheconfig
|
||||
rm -f $config
|
||||
rm -f $installconfig
|
||||
rm -f $lockfile
|
||||
rmdir $targetdir/doc >/dev/null 2>&1
|
||||
rmdir $targetdir/htdocs >/dev/null 2>&1
|
||||
|
||||
|
||||
@ -65,6 +65,13 @@ Alias /dolibarr /var/www/dolibarr/htdocs
|
||||
Allow from all
|
||||
</DirectoryMatch>
|
||||
|
||||
# Config files
|
||||
<DirectoryMatch /etc/dolibarr>
|
||||
AllowOverride All
|
||||
Order deny,allow
|
||||
Allow from all
|
||||
</DirectoryMatch>
|
||||
|
||||
# Directory for data files
|
||||
<DirectoryMatch /usr/share/dolibarr/documents>
|
||||
AllowOverride All
|
||||
|
||||
@ -4,9 +4,9 @@ $force_install_message='KeepDefaultValuesDeb';
|
||||
$force_install_main_data_root='/usr/share/dolibarr/documents';
|
||||
$force_install_type='mysqli';
|
||||
$force_install_port='3306';
|
||||
$force_install_database='dolibarr';
|
||||
$force_install_database='dolibarrrpm';
|
||||
$force_install_createdatabase='1';
|
||||
$force_install_databaselogin='dolibarrmysql';
|
||||
$force_install_databaselogin='dolibarrrpm';
|
||||
$force_install_databasepass='';
|
||||
$force_install_createuser='1';
|
||||
$force_install_databaserootlogin='__SUPERUSERLOGIN__';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user