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