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