wok view dolibarr/receipt @ rev 15845

dosfstools: update genpkg_rules
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jan 27 11:23:53 2014 +0000 (2014-01-27)
parents e8f8935f9363
children 9e01bc6321ea
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 LICENSE="LGPL2"
9 WEB_SITE="http://www.dolibarr.fr/"
10 TARBALL="$PACKAGE-$VERSION.tgz"
11 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
13 DEPENDS="apache php-apache php-gd php-mysqli"
14 BUILD_DEPENDS=""
16 # Rules to configure and make the package.
17 compile_rules()
18 {
19 cd $src
21 # Fix attributs and perms
22 chown -R root.root *
23 chmod -x C* I* R*
24 find . \( -name "*.php" \
25 -o -name "*.png" \
26 -o -name "*.jpg" \
27 -o -name "*.gif" \
28 -o -name "*.txt" \
29 -o -name "*.ico" \
30 -o -name "*.html" \) -exec chmod -x {} \;
31 }
33 # Rules to gen a SliTaz package suitable for Tazpkg.
34 genpkg_rules()
35 {
37 mkdir -p $fs/etc/dolibarr \
38 $fs/usr/share/dolibarr \
39 $fs/var/lib/dolibarr/documents \
40 $fs/usr/share/doc/$PACKAGE/schemas \
41 $fs/usr/share/applications
44 cp -a $src/htdocs $fs/usr/share/dolibarr
45 cp -a $src/scripts $fs/usr/share/dolibarr
47 # Remove install directory
48 #rm -rf $fs/usr/share/dolibarr/htdocs/install
50 # Populate documents directory
51 for dir in facture users propale mycompany ficheinter produit rapport
52 do
53 mkdir $fs/var/lib/dolibarr/documents/$dir
54 done
56 # Fix perms
57 chown -R root.www $fs/var/lib/dolibarr/documents
58 chmod -R 770 $fs/var/lib/dolibarr/documents
60 cp $stuff/conf.php $fs/etc/dolibarr
61 cp $stuff/$PACKAGE-$VERSION-mysql.sql $fs/usr/share/doc/$PACKAGE/schemas
62 cp -a $stuff/pixmaps $fs/usr/share/
64 ln -s /etc/dolibarr/conf.php $fs/usr/share/dolibarr/htdocs/conf
66 }
68 post_install(){
70 db_name=dolibarr
71 db_user=dolibarr
72 db_password=dolibarr
74 # Configure apache server
75 if [ -f $1/etc/apache/httpd.conf ]; then
76 if [ ! -f $1/etc/apache/conf.d/dolibarr.conf ]; then
77 cat > $1/etc/apache/conf.d/dolibarr.conf <<EOT
78 <IfModule mod_alias.c>
79 Alias /dolibarr /usr/share/dolibarr/htdocs
80 </IfModule>
81 <Directory "/usr/share/dolibarr/htdocs">
82 Options Indexes FollowSymLinks
83 AllowOverride None
84 Order deny,allow
85 Allow from all
86 </Directory>
88 EOT
89 if [ -z "$1" ]; then
90 # Start Web server.
91 test -f /var/run/apache/httpd.pid && \
92 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
93 fi
94 fi
95 fi
97 # Configure every thing.
98 if [ -z $1 ]; then
99 if ( ! mysqladmin -s ping > /dev/null ); then
100 echo "Starting MySQL server"
101 ( /etc/init.d/mysql start ; status ) || exit
102 sleep 4 #let the mysql daemon start
103 fi
104 if ( ! mysql -u root -Be 'show databases' | grep -q $db_name ); then
105 echo -n "Create $db_name database"
106 mysql -Be "create database $db_name" ; status
107 # We suppose that databse user does not exist.
108 # It may be false.
109 echo -n "Create user $db_user with password $db_password"
110 mysql -Be "grant all privileges on ${db_name}.* to '$db_user'@'localhost'
111 identified by '$db_password'" ; status
112 # At last populate the database.
113 echo -n "Create $db_name database schema."
114 mysql -u $db_user -p${db_password} -D $db_name < /usr/share/doc/dolibarr/schemas/$PACKAGE-$VERSION-mysql.sql ; status
116 fi
118 fi
119 }