wok annotate dolibarr/receipt @ rev 15777

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