wok rev 2714

Add: glpi
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Thu Apr 23 16:13:34 2009 +0200 (2009-04-23)
parents f04f5973ca78
children 8b97e8e73827
files glpi/receipt glpi/stuff/config_db.php
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/glpi/receipt	Thu Apr 23 16:13:34 2009 +0200
     1.3 @@ -0,0 +1,113 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKED_SIZE="2.0M"
     1.7 +UNPACKED_SIZE="11.5M"
     1.8 +PACKAGE="glpi"
     1.9 +VERSION="0.71.5"
    1.10 +CATEGORY="network"
    1.11 +SHORT_DESC="IT and Asset Management."
    1.12 +MAINTAINER="erjo@slitaz.org"
    1.13 +DEPENDS="mysql apache php-apache php-ldap php-imap php-mysql pam"
    1.14 +TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.15 +WEB_SITE="http://glpi-project.org/"
    1.16 +WGET_URL="http://glpi-project.org/IMG/gz/$TARBALL"
    1.17 +CONFIG_FILES="/etc/glpi/config/config_db.php"
    1.18 +
    1.19 +
    1.20 +
    1.21 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.22 +genpkg_rules()
    1.23 +{
    1.24 +	test -d $PACKAGE && mv $PACKAGE $PACKAGE-$VERSION
    1.25 +	
    1.26 +	_pkg=$src
    1.27 +	
    1.28 +	mkdir -p $fs/usr/share/$PACKAGE \
    1.29 +		$fs/etc/$PACKAGE \
    1.30 +		$fs/var/lib/$PACKAGE
    1.31 +		 
    1.32 +	cp -a $_pkg/* $fs/usr/share/$PACKAGE
    1.33 +	[ -d $fs/usr/share/$PACKAGE/files ] &&  mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE
    1.34 +	[ -d $fs/usr/share/$PACKAGE/config ] &&  mv $fs/usr/share/$PACKAGE/config $fs/etc/$PACKAGE
    1.35 +
    1.36 +	cd $fs/usr/share/glpi
    1.37 +	ln -s /etc/glpi/config ; ln -s /var/lib/glpi/files
    1.38 +	cd -
    1.39 +	chown -R www.www $fs/var/lib/$PACKAGE/files $fs/etc/$PACKAGE/config
    1.40 +	# Copy config db as temporary file.
    1.41 +	cp stuff/config_db.php $fs/etc/glpi/config/
    1.42 +	# Configure apache server
    1.43 +	if [ -f $1/etc/apache/httpd.conf ]; then
    1.44 +		if [ ! -f $1/etc/apache/conf.d/glpi ]; then
    1.45 +			cat > $1/etc/apache/conf.d/glpi <<EOT
    1.46 +<IfModule mod_alias.c>
    1.47 +    Alias /glpi /usr/share/glpi/
    1.48 +</IfModule>
    1.49 +<Directory "/usr/share/glpi">
    1.50 +	Options Indexes FollowSymLinks
    1.51 +	AllowOverride None
    1.52 +	Order deny,allow
    1.53 +	Allow from all
    1.54 +</Directory>
    1.55 +
    1.56 +EOT
    1.57 +			if [ -z "$1" ]; then
    1.58 +				# Start Web server.
    1.59 +				test -f /var/run/apache/httpd.pid && \
    1.60 +					( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
    1.61 +			fi
    1.62 +		fi
    1.63 +	fi
    1.64 +}
    1.65 +
    1.66 +post_install()
    1.67 +{
    1.68 +	# Configure every thing for glpi.
    1.69 +	if [ -z $1 ]; then
    1.70 +		if ( ! mysqladmin -s ping > /dev/null ); then
    1.71 +			echo "Starting MySQL server"
    1.72 +			( /etc/init.d/mysql start ; status  ) || exit 
    1.73 +			sleep 4 #let the mysql daemon start
    1.74 +		fi
    1.75 +		if ( ! mysql -Be 'show databases' | grep -q glpi ); then
    1.76 +			echo -n "Create Glpi database"
    1.77 +			mysql -Be "create database glpi" ; status
    1.78 +			# We suppose that glpi user does not exist.
    1.79 +			# It may be false.
    1.80 +			echo  -n "Create user glpi with password glpi"
    1.81 +			mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost' 
    1.82 +				identified by 'glpi'" ; status
    1.83 +			# At last create the database for glpi.
    1.84 +			echo -n "Create glpi database schema."
    1.85 +			mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-0.71.3-empty.sql ; status
    1.86 +			
    1.87 +		fi
    1.88 +			
    1.89 +	fi
    1.90 +}
    1.91 +
    1.92 +post_remove()
    1.93 +{
    1.94 +		echo -n "Would you like to remove data and database files.(y/n) "
    1.95 +		read answer
    1.96 +
    1.97 +		case $answer in 
    1.98 +		y|Y)
    1.99 +			echo -n "Removing data directories..."
   1.100 +			rm -rf /var/lib/glpi ; status
   1.101 +			if ( ! mysql -Be 'show databases' | grep -q glpi ); then
   1.102 +				echo -n "Deleting Glpi database"
   1.103 +				mysql -Be "drop database glpi" ; status
   1.104 +				# We suppose that glpi user does not exist.
   1.105 +				# It may be false.
   1.106 +				echo  -n "Delete user glpi"
   1.107 +				mysql -Be "delete from mysql.db where user=glpi" ; status
   1.108 +			fi
   1.109 +			unset $answer
   1.110 +			;;
   1.111 +		*)
   1.112 +			;;
   1.113 +		esac
   1.114 +	
   1.115 +}
   1.116 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/glpi/stuff/config_db.php	Thu Apr 23 16:13:34 2009 +0200
     2.3 @@ -0,0 +1,8 @@
     2.4 +<?php 
     2.5 + class DB extends DBmysql { 
     2.6 + var $dbhost	= 'localhost'; 
     2.7 + var $dbuser 	= 'glpi'; 
     2.8 + var $dbpassword= 'glpi'; 
     2.9 + var $dbdefault	= 'glpi'; 
    2.10 + } 
    2.11 + ?>
    2.12 \ No newline at end of file