Work on packaging RPM & DEB

This commit is contained in:
Laurent Destailleur 2011-07-09 17:42:07 +00:00
parent 2fbb277c96
commit 24d8f1d1c7
6 changed files with 41 additions and 150 deletions

View File

@ -1,17 +1,6 @@
#!/bin/sh #!/bin/sh
# Debian install package run: config, preinst, prerm, postinst, postrm # Debian install package run: config, preinst, prerm, postinst, postrm
# #
# lintian package To test a package
#
# dpkg -l list all packages
# dpkg -b is to build package
# dpkg -c package.deb list content of package
# dpkg -I package.deb give informations on package
# dpkg -i package.deb install a package
#
# dpkg -L packagename list content of installed package
# dpkg --purge remove interactive saved answers
#
set -e set -e

View File

@ -3,7 +3,7 @@ Version: __VERSION__
Architecture: all Architecture: all
Maintainer: Laurent Destailleur <eldy@users.sourceforge.net> Maintainer: Laurent Destailleur <eldy@users.sourceforge.net>
Essential: no Essential: no
Installed-Size: 31200 Installed-Size: 61200
Depends: apache2, libapache2-mod-php5, php5, php5-cli, php5-cgi, php5-curl, php5-gd, php5-ldap, php5-mysql, mysql-server, perl Depends: apache2, libapache2-mod-php5, php5, php5-cli, php5-cgi, php5-curl, php5-gd, php5-ldap, php5-mysql, mysql-server, perl
Section: web Section: web
Priority: optional Priority: optional
@ -14,6 +14,7 @@ Description: Easy to use ERP & CRM software to manage your activity.
and medium companies, foundations or freelances. It includes different and medium companies, foundations or freelances. It includes different
features for Enterprise Resource Planning (ERP) and Customer Relationship features for Enterprise Resource Planning (ERP) and Customer Relationship
Management (CRM) but also for different other activities. Management (CRM) but also for different other activities.
Dolibarr was designed to provide only features you need and be easy to use.
. .
Only features you need are visible, depending on which module were activated. Only features you need are visible, depending on which module were activated.
Most common used modules are: Most common used modules are:
@ -41,4 +42,6 @@ Description: Easy to use ERP & CRM software to manage your activity.
* LDAP connectivity * LDAP connectivity
* PDF exports * PDF exports
* And a lot of more modules... * And a lot of more modules...
.
You can also add third parties external modules or develop yours. You can also add third parties external modules or develop yours.

View File

@ -108,12 +108,6 @@ case "$1" in
done done
# Copy icon file
#echo "Copy icon file"
#fileorig="/usr/share/dolibarr/doc/images/dolibarr.xpm"
#target="/usr/share/pixmaps/"
#cp -f $fileorig $target
#echo "Install menu entry" #echo "Install menu entry"
# This one is for Gnome ubuntu # This one is for Gnome ubuntu
#fileorig="/usr/share/dolibarr/build/deb/dolibarr.desktop" #fileorig="/usr/share/dolibarr/build/deb/dolibarr.desktop"

View File

@ -10,15 +10,6 @@ with format RPM (for Redhat, Mandriva, ...).
# This is standard command to work on Debian packaging: # This is standard command to work on Debian packaging:
# #
# On Fedora # yum install dolibarr To remove package
# rpm -i --test dolibarr-...rpm To list dependencies of RPM
# yum install dolibarr-...rpm To install package and dependencies
# yum erase dolibarr To remove package # yum erase dolibarr To remove package
# #
# On OpenSuse
# yast --install dolibarr-...rpm To install package and dependencies
# yast --remove dolibarr To remove package
#
# On Mageia (after su - root)
# urpmi dolibarr-...rpm To install package and dependencies
# urpme dolibarr To remove package

View File

@ -5,12 +5,9 @@ Version=1.0
Encoding=UTF-8 Encoding=UTF-8
Name=Dolibarr ERP & CRM Name=Dolibarr ERP & CRM
Name[fr]=Dolibarr ERP & CRM Name[fr]=Dolibarr ERP & CRM
Name[it]=Dolibarr ERP & CRM
GenericName=Dolibarr ERP & CRM GenericName=Dolibarr ERP & CRM
Comment=The easy to use manager (ERP & CRM) for small and medium enterprises or foundations Comment=The easy to use manager (ERP & CRM) for small and medium enterprises or foundations
Comment[fr]=L'ERP & CRM simple pour la gestion des TPE, PME, associations et auto-entrepreneurs Comment[fr]=L'ERP & CRM simple pour la gestion des PME et associations
Comment[it]=Programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti
Comment[es]=Software para gestión de PYMES, profesionales independientes, auto emprendedores ó asociaciones
# Command to open an URL # Command to open an URL
# For Fedora: xdg-open # For Fedora: xdg-open
# For Debian/Ubuntu: x-www-browser # For Debian/Ubuntu: x-www-browser

View File

@ -19,32 +19,20 @@ Packager: Laurent Destailleur (Eldy) <eldy@users.sourceforge.net>
Vendor: Dolibarr dev team Vendor: Dolibarr dev team
URL: http://www.%{name}.org URL: http://www.%{name}.org
#Source: http://sourceforge.net/projects/%{name}/files/Dolibarr%20ERP-CRM/%{version}/%{name}-%{version}.tgz/download
Source: /usr/src/RPM/SOURCES/%{name}-%{version}.tgz Source: /usr/src/RPM/SOURCES/%{name}-%{version}.tgz
#BuildArch: noarch #BuildArch: noarch
#BuildArchitectures: noarch #BuildArchitectures: noarch
BuildRoot: /tmp/%{name}-buildroot BuildRoot: /tmp/%{name}-buildroot
#Icon: dolibarr_logo1.gif #Icon: dolibarr_logo1.gif
# For Mandriva-Mageia # For Mandrake
Group: Networking/WWW Group: Networking/WWW
# For all other distrib # For all other distrib
Group: Applications/Internet Group: Applications/Internet
# Requires can use lua to be defined dynamically (but still at build time)
# %{lua: if posix.access("/aaa") then print("Requires: bidon1 mysql-server mysql httpd php php-cli php-gd php-ldap php-imap php-mysql") end }
# Requires for Fedora-Redhat
Requires: mysql-server mysql httpd php php-cli php-gd php-ldap php-imap php-mysql Requires: mysql-server mysql httpd php php-cli php-gd php-ldap php-imap php-mysql
# Requires for OpenSuse AutoReqProv: yes
#Requires: mysql-community-server mysql-community-server-client apache2 apache2-mod_php5 php5 php5-gd php5-ldap php5-imap php5-mysql php5-openssl
# Requires for Mandriva-Mageia
#Requires: mysql mysql-client apache-base apache-mod_php php-cgi php-cli php-bz2 php-gd php-ldap php-imap php-mysqli php-openssl
#Requires(pre):
#Requires(postun):
# Set yes to build test package, no for release (this disable need of /usr/bin/php not found by OpenSuse)
AutoReqProv: no
%description %description
@ -55,31 +43,12 @@ Management (CRM) but also for different other activities.
Dolibarr was designed to provide only features you need and be easy to Dolibarr was designed to provide only features you need and be easy to
use. use.
%description -l es
Dolibarr ERP y CRM es un software open source/gratis para pequeñas y
medianas empresas, asociaciones o autónomos. Incluye diferentes
funcionalidades para la Planificación de Recursos Empresariales (ERP) y
Gestión de la Relación con los Clientes (CRM) así como para para otras
diferentes actividades. Dolibarr ha sido diseñado para suministrarle
solamente las funcionalidades que necesita y haciendo hincapié en su
facilidad de uso.
%description -l fr %description -l fr
Dolibarr ERP & CRM est un logiciel de gestion de PME/PMI, autoentrepreneurs, Dolibarr ERP & CRM est un logiciel de gestion de PME/PMI, autoentrepreneurs,
artisans ou associations. Il permet de gérer vos clients, prospect, artisans ou associations. Il permet de gérer vos clients, prospect,
fournisseurs, devis, factures, comptes bancaires, agenda, campagne emailings fournisseurs, devis, factures, comptes bancaires, agenda, campagne emailings
et bien d'autres choses dans une interface pensée pour la simplicité. et bien d'autres choses dans une interface pensée pour la simplicité.
%description -l it
Dolibarr è un programma gestionale open source e gratuito per piccole e medie
imprese, fondazioni e liberi professionisti. Include varie funzionalità per
Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori
attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno
ed essere facile da usare.
Dolibar è completamente web-based, progettato per poter fornire solo ciò di
cui hai bisogno ed essere facile da usare.
#---- prep #---- prep
%prep %prep
@ -100,6 +69,8 @@ mkdir -p $RPM_BUILD_ROOT/var/www/dolibarr/build
mkdir -p $RPM_BUILD_ROOT/var/www/dolibarr/doc mkdir -p $RPM_BUILD_ROOT/var/www/dolibarr/doc
mkdir -p $RPM_BUILD_ROOT/var/www/dolibarr/htdocs mkdir -p $RPM_BUILD_ROOT/var/www/dolibarr/htdocs
mkdir -p $RPM_BUILD_ROOT/var/www/dolibarr/scripts mkdir -p $RPM_BUILD_ROOT/var/www/dolibarr/scripts
#mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/dolibarr
#mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/cron.daily
mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
cp doc/images/dolibarr_48x48.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/dolibarr.png cp doc/images/dolibarr_48x48.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/dolibarr.png
@ -113,6 +84,17 @@ cp -pr doc $RPM_BUILD_ROOT/var/www/dolibarr
cp -pr htdocs $RPM_BUILD_ROOT/var/www/dolibarr cp -pr htdocs $RPM_BUILD_ROOT/var/www/dolibarr
cp -pr scripts $RPM_BUILD_ROOT/var/www/dolibarr cp -pr scripts $RPM_BUILD_ROOT/var/www/dolibarr
# menu
#%{__install} -d $RPM_BUILD_ROOT%{_menudir}
#%{__cat} <<EOF >$RPM_BUILD_ROOT%{_menudir}/%{name}
#?package(%{name}):\
#command="Dolibarr" \
#section="Office" \
#title="Dolibarr" \
#icon="dolibarr_48x48.png" \
#longtitle="Dolibarr ERP & CRM"
#EOF
#---- clean #---- clean
%clean %clean
@ -178,59 +160,30 @@ if [ ! -f %{_sysconfdir}/dolibarr/apache.conf ]; then
chmod go-w %{_sysconfdir}/dolibarr/apache.conf chmod go-w %{_sysconfdir}/dolibarr/apache.conf
fi fi
# Create a config link %{_sysconfdir}/httpd/conf.d/dolibarr.conf
# Detect OS if [ ! -f %{_sysconfdir}/httpd/conf.d/dolibarr.conf ]; then
os='unknown'; echo Create dolibarr web server config link %{_sysconfdir}/httpd/conf.d/dolibarr.conf
if [ -d %{_sysconfdir}/httpd/conf.d ]; then ln -fs /etc/dolibarr/apache.conf %{_sysconfdir}/httpd/conf.d/dolibarr.conf
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
fi fi
# Set permissions # Set permissions
echo Set permission to $apacheuser:$apachegroup on $targetdir echo Set permission on $targetdir
chown -R $apacheuser:$apachegroup $targetdir chown -R apache.apache $targetdir
chmod -R a-w $targetdir chmod -R a-w $targetdir
echo Set permission to $apacheuser:$apachegroup on $docdir echo Set permission on $docdir
chown -R $apacheuser:$apachegroup $docdir chown -R apache.apache $docdir
chmod -R o-w $docdir chmod -R o-w $docdir
# Create empty conf.php file for web installer # Create empty conf.php file for web installer
if [ ! -s $targetdir/htdocs/conf/conf.php ]; then if [ ! -s $targetdir/htdocs/conf/conf.php ]; then
echo Create empty Dolibarr conf.php file echo Create empty Dolibarr conf.php file
touch $targetdir/htdocs/conf/conf.php touch $targetdir/htdocs/conf/conf.php
chown $apacheuser:$apachegroup $targetdir/htdocs/conf/conf.php chown apache.apache $targetdir/htdocs/conf/conf.php
chmod ug+rw $targetdir/htdocs/conf/conf.php chmod ug+rw $targetdir/htdocs/conf/conf.php
fi fi
if [ "x$os" = "xfedora-redhat" -a -s /usr/bin/chcon ]; then if [ -s /usr/bin/chcon ]; then
echo Set SELinux permissions echo Set SELinux permissions
# Warning: chcon seems not cumulative # Warning: chcon seems not cumulative
#chcon -R -h -t httpd_sys_content_t $targetdir #chcon -R -h -t httpd_sys_content_t $targetdir
@ -245,9 +198,6 @@ echo Restart web server
if [ -f %{_sysconfdir}/init.d/httpd ]; then if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart %{_sysconfdir}/init.d/httpd restart
fi fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
# Show result # Show result
echo echo
@ -264,39 +214,12 @@ echo
%postun %postun
%clean_menus %clean_menus
# 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
# 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 are stored into /usr/share/dolibarr/documents
export docdir='/usr/share/dolibarr/documents' export docdir='/usr/share/dolibarr/documents'
export conffile="%{_sysconfdir}/httpd/conf.d/dolibarr.conf"
if [ -f $conffile ] ; if [ -f $conffile ] ;
then then
echo Delete apache config file for Dolibarr echo Delete apache config file for Dolibarr
@ -311,17 +234,11 @@ then
if [ -f %{_sysconfdir}/init.d/httpd ]; then if [ -f %{_sysconfdir}/init.d/httpd ]; then
%{_sysconfdir}/init.d/httpd restart %{_sysconfdir}/init.d/httpd restart
fi fi
if [ -f %{_sysconfdir}/init.d/apache2 ]; then
%{_sysconfdir}/init.d/apache2 restart
fi
fi fi
# Removed dirs after apache restart
echo Removed remaining dirs
rm -rf /etc/dolibarr rm -rf /etc/dolibarr
rm -rf $targetdir/htdocs/conf rm -rf $targetdir/htdocs/conf
rm -rf $targetdir/htdocs/install rm -rf $targetdir/htdocs/install
rmdir $targetdir/doc >/dev/null 2>&1
rmdir $targetdir/htdocs >/dev/null 2>&1
%changelog %changelog