wok-6.x annotate dolibarr/receipt @ rev 12949

asterisk: dahdi needs tonezone
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu May 31 09:56:44 2012 +0200 (2012-05-31)
parents 47d5f52ef21a
children a00bf44ed23d
rev   line source
erjo@11794 1 # SliTaz package receipt.
erjo@11794 2
erjo@11794 3 PACKAGE="dolibarr"
erjo@11794 4 VERSION="3.1.0"
erjo@11794 5 CATEGORY="office"
erjo@11794 6 SHORT_DESC="ERP/CRM"
erjo@11794 7 MAINTAINER="erjo@slitaz.org"
erjo@11794 8 WEB_SITE="http://www.dolibarr.fr/"
erjo@11794 9 TARBALL="$PACKAGE-$VERSION.tgz"
erjo@11794 10 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
erjo@11794 11
erjo@11827 12 DEPENDS="apache php-apache php-gd php-mysqli"
erjo@11794 13 BUILD_DEPENDS=""
erjo@11794 14
erjo@11794 15 # Rules to configure and make the package.
erjo@11794 16 compile_rules()
erjo@11794 17 {
erjo@11794 18 cd $src
erjo@11794 19
erjo@11794 20 # Fix attributs 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
erjo@11794 74 if [ -f $1/etc/apache/httpd.conf ]; then
erjo@11794 75 if [ ! -f $1/etc/apache/conf.d/dolibarr.conf ]; then
erjo@11794 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.
erjo@11794 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 }