wok-6.x view dolibarr/receipt @ rev 11827

dolibarr: Imporove recepit. Update database schema
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Mon Feb 27 00:37:33 2012 +0100 (2012-02-27)
parents 47d5f52ef21a
children a00bf44ed23d
line source
1 # SliTaz package receipt.
3 PACKAGE="dolibarr"
4 VERSION="3.1.0"
5 CATEGORY="office"
6 SHORT_DESC="ERP/CRM"
7 MAINTAINER="erjo@slitaz.org"
8 WEB_SITE="http://www.dolibarr.fr/"
9 TARBALL="$PACKAGE-$VERSION.tgz"
10 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
12 DEPENDS="apache php-apache php-gd php-mysqli"
13 BUILD_DEPENDS=""
15 # Rules to configure and make the package.
16 compile_rules()
17 {
18 cd $src
20 # Fix attributs and perms
21 chown -R root.root *
22 chmod -x C* I* R*
23 find . \( -name "*.php" \
24 -o -name "*.png" \
25 -o -name "*.jpg" \
26 -o -name "*.gif" \
27 -o -name "*.txt" \
28 -o -name "*.ico" \
29 -o -name "*.html" \) -exec chmod -x {} \;
30 }
32 # Rules to gen a SliTaz package suitable for Tazpkg.
33 genpkg_rules()
34 {
36 mkdir -p $fs/etc/dolibarr \
37 $fs/usr/share/dolibarr \
38 $fs/var/lib/dolibarr/documents \
39 $fs/usr/share/doc/$PACKAGE/schemas \
40 $fs/usr/share/applications
43 cp -a $src/htdocs $fs/usr/share/dolibarr
44 cp -a $src/scripts $fs/usr/share/dolibarr
46 # Remove install directory
47 #rm -rf $fs/usr/share/dolibarr/htdocs/install
49 # Populate documents directory
50 for dir in facture users propale mycompany ficheinter produit rapport
51 do
52 mkdir $fs/var/lib/dolibarr/documents/$dir
53 done
55 # Fix perms
56 chown -R root.www $fs/var/lib/dolibarr/documents
57 chmod -R 770 $fs/var/lib/dolibarr/documents
59 cp $stuff/conf.php $fs/etc/dolibarr
60 cp $stuff/$PACKAGE-$VERSION-mysql.sql $fs/usr/share/doc/$PACKAGE/schemas
61 cp -a $stuff/pixmaps $fs/usr/share/
63 ln -s /etc/dolibarr/conf.php $fs/usr/share/dolibarr/htdocs/conf
65 }
67 post_install(){
69 db_name=dolibarr
70 db_user=dolibarr
71 db_password=dolibarr
73 # Configure apache server
74 if [ -f $1/etc/apache/httpd.conf ]; then
75 if [ ! -f $1/etc/apache/conf.d/dolibarr.conf ]; then
76 cat > $1/etc/apache/conf.d/dolibarr.conf <<EOT
77 <IfModule mod_alias.c>
78 Alias /dolibarr /usr/share/dolibarr/htdocs
79 </IfModule>
80 <Directory "/usr/share/dolibarr/htdocs">
81 Options Indexes FollowSymLinks
82 AllowOverride None
83 Order deny,allow
84 Allow from all
85 </Directory>
87 EOT
88 if [ -z "$1" ]; then
89 # Start Web server.
90 test -f /var/run/apache/httpd.pid && \
91 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
92 fi
93 fi
94 fi
96 # Configure every thing.
97 if [ -z $1 ]; then
98 if ( ! mysqladmin -s ping > /dev/null ); then
99 echo "Starting MySQL server"
100 ( /etc/init.d/mysql start ; status ) || exit
101 sleep 4 #let the mysql daemon start
102 fi
103 if ( ! mysql -u root -Be 'show databases' | grep -q $db_name ); then
104 echo -n "Create $db_name database"
105 mysql -Be "create database $db_name" ; status
106 # We suppose that databse user does not exist.
107 # It may be false.
108 echo -n "Create user $db_user with password $db_password"
109 mysql -Be "grant all privileges on ${db_name}.* to '$db_user'@'localhost'
110 identified by '$db_password'" ; status
111 # At last populate the database.
112 echo -n "Create $db_name database schema."
113 mysql -u $db_user -p${db_password} -D $db_name < /usr/share/doc/dolibarr/schemas/$PACKAGE-$VERSION-mysql.sql ; status
115 fi
117 fi
118 }