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