wok-stable diff dolibarr/receipt @ rev 11794

Add: dolibarr
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Sat Feb 25 00:38:05 2012 +0100 (2012-02-25)
parents
children e8f8935f9363
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dolibarr/receipt	Sat Feb 25 00:38:05 2012 +0100
     1.3 @@ -0,0 +1,118 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="dolibarr"
     1.7 +VERSION="3.1.0"
     1.8 +CATEGORY="office"
     1.9 +SHORT_DESC="ERP/CRM"
    1.10 +MAINTAINER="erjo@slitaz.org"
    1.11 +WEB_SITE="http://www.dolibarr.fr/"
    1.12 +TARBALL="$PACKAGE-$VERSION.tgz"
    1.13 +WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
    1.14 +
    1.15 +DEPENDS="apache php-apache "
    1.16 +BUILD_DEPENDS=""
    1.17 +
    1.18 +# Rules to configure and make the package.
    1.19 +compile_rules()
    1.20 +{
    1.21 +	cd $src
    1.22 +	
    1.23 +	# Fix attributs and perms
    1.24 +	chown -R root.root *
    1.25 +	chmod -x C* I* R* 
    1.26 +	find . \( -name "*.php" \
    1.27 +		-o -name "*.png" \
    1.28 +		-o -name "*.jpg" \
    1.29 +		-o -name "*.gif" \
    1.30 +		-o -name "*.txt" \
    1.31 +		-o -name "*.ico" \
    1.32 +		-o -name "*.html" \) -exec chmod -x {} \;
    1.33 +}
    1.34 +
    1.35 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.36 +genpkg_rules()
    1.37 +{
    1.38 +	
    1.39 +	mkdir -p $fs/etc/dolibarr \
    1.40 +		$fs/usr/share/dolibarr \
    1.41 +		$fs/var/lib/dolibarr/documents \
    1.42 +		$fs/usr/share/doc/$PACKAGE/schemas \
    1.43 +		$fs/usr/share/applications 
    1.44 +		
    1.45 +	
    1.46 +	cp -a $src/htdocs $fs/usr/share/dolibarr
    1.47 +	cp -a $src/scripts $fs/usr/share/dolibarr
    1.48 +	
    1.49 +	# Remove install directory
    1.50 +	rm -rf $fs/usr/share/dolibarr/htdocs/install
    1.51 +	
    1.52 +	# Populate documents directory
    1.53 +	for dir in facture users propale mycompany ficheinter produit rapport
    1.54 +	do
    1.55 +		mkdir $fs/var/lib/dolibarr/documents/$dir
    1.56 +	done
    1.57 +	
    1.58 +	# Fix perms
    1.59 +	chown -R root.www $fs/var/lib/dolibarr/documents
    1.60 +	chmod -R 770 $fs/var/lib/dolibarr/documents
    1.61 +	
    1.62 +	cp $stuff/conf.php $fs/etc/dolibarr
    1.63 +	cp $stuff/$PACKAGE-$VERSION-mysql.sql $fs/usr/share/doc/$PACKAGE/schemas
    1.64 +	cp -a $stuff/pixmaps $fs/usr/share/
    1.65 +	
    1.66 +	ln -s /etc/dolibarr/conf.php $fs/usr/share/dolibarr/htdocs/conf
    1.67 +
    1.68 +}
    1.69 +
    1.70 +post_install(){
    1.71 +	
    1.72 +	db_name=dolibarr
    1.73 +	db_user=dolibarr
    1.74 +	db_password=dolibarr
    1.75 +	
    1.76 +	# Configure apache server
    1.77 +	if [ -f $1/etc/apache/httpd.conf ]; then
    1.78 +		if [ ! -f $1/etc/apache/conf.d/dolibarr.conf ]; then
    1.79 +			cat > $1/etc/apache/conf.d/dolibarr.conf <<EOT
    1.80 +<IfModule mod_alias.c>
    1.81 +    Alias /dolibarr /usr/share/dolibarr/htdocs
    1.82 +</IfModule>
    1.83 +<Directory "/usr/share/dolibarr/htdocs">
    1.84 +	Options Indexes FollowSymLinks
    1.85 +	AllowOverride None
    1.86 +	Order deny,allow
    1.87 +	Allow from all
    1.88 +</Directory>
    1.89 +
    1.90 +EOT
    1.91 +			if [ -z "$1" ]; then
    1.92 +				# Start Web server.
    1.93 +				test -f /var/run/apache/httpd.pid && \
    1.94 +					( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
    1.95 +			fi
    1.96 +		fi
    1.97 +	fi
    1.98 +	
    1.99 +	# Configure every thing.
   1.100 +	if [ -z $1 ]; then
   1.101 +		if ( ! mysqladmin -s ping > /dev/null ); then
   1.102 +			echo "Starting MySQL server"
   1.103 +			( /etc/init.d/mysql start ; status  ) || exit 
   1.104 +			sleep 4 #let the mysql daemon start
   1.105 +		fi
   1.106 +		if ( ! mysql -u root -Be 'show databases' | grep -q $db_name ); then
   1.107 +			echo -n "Create $db_name database"
   1.108 +			mysql -Be "create database $db_name" ; status
   1.109 +			# We suppose that databse user does not exist.
   1.110 +			# It may be false.
   1.111 +			echo  -n "Create user $db_user with password $db_password"
   1.112 +			mysql -Be "grant all privileges on ${db_name}.* to '$db_user'@'localhost' 
   1.113 +				identified by '$db_password'" ; status
   1.114 +			# At last populate the database.
   1.115 +			echo -n "Create $db_name database schema."
   1.116 +			mysql -u $db_user -p${db_password} -D $db_name < /usr/share/doc/dolibarr/schemas/$PACKAGE-$VERSION-mysql.sql ; status
   1.117 +			
   1.118 +		fi
   1.119 +			
   1.120 +	fi
   1.121 +}