wok view glpi/receipt @ rev 2714

Add: glpi
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Thu Apr 23 16:13:34 2009 +0200 (2009-04-23)
parents
children 8b97e8e73827
line source
1 # SliTaz package receipt.
3 PACKED_SIZE="2.0M"
4 UNPACKED_SIZE="11.5M"
5 PACKAGE="glpi"
6 VERSION="0.71.5"
7 CATEGORY="network"
8 SHORT_DESC="IT and Asset Management."
9 MAINTAINER="erjo@slitaz.org"
10 DEPENDS="mysql apache php-apache php-ldap php-imap php-mysql pam"
11 TARBALL="$PACKAGE-$VERSION.tar.gz"
12 WEB_SITE="http://glpi-project.org/"
13 WGET_URL="http://glpi-project.org/IMG/gz/$TARBALL"
14 CONFIG_FILES="/etc/glpi/config/config_db.php"
18 # Rules to gen a SliTaz package suitable for Tazpkg.
19 genpkg_rules()
20 {
21 test -d $PACKAGE && mv $PACKAGE $PACKAGE-$VERSION
23 _pkg=$src
25 mkdir -p $fs/usr/share/$PACKAGE \
26 $fs/etc/$PACKAGE \
27 $fs/var/lib/$PACKAGE
29 cp -a $_pkg/* $fs/usr/share/$PACKAGE
30 [ -d $fs/usr/share/$PACKAGE/files ] && mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE
31 [ -d $fs/usr/share/$PACKAGE/config ] && mv $fs/usr/share/$PACKAGE/config $fs/etc/$PACKAGE
33 cd $fs/usr/share/glpi
34 ln -s /etc/glpi/config ; ln -s /var/lib/glpi/files
35 cd -
36 chown -R www.www $fs/var/lib/$PACKAGE/files $fs/etc/$PACKAGE/config
37 # Copy config db as temporary file.
38 cp stuff/config_db.php $fs/etc/glpi/config/
39 # Configure apache server
40 if [ -f $1/etc/apache/httpd.conf ]; then
41 if [ ! -f $1/etc/apache/conf.d/glpi ]; then
42 cat > $1/etc/apache/conf.d/glpi <<EOT
43 <IfModule mod_alias.c>
44 Alias /glpi /usr/share/glpi/
45 </IfModule>
46 <Directory "/usr/share/glpi">
47 Options Indexes FollowSymLinks
48 AllowOverride None
49 Order deny,allow
50 Allow from all
51 </Directory>
53 EOT
54 if [ -z "$1" ]; then
55 # Start Web server.
56 test -f /var/run/apache/httpd.pid && \
57 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
58 fi
59 fi
60 fi
61 }
63 post_install()
64 {
65 # Configure every thing for glpi.
66 if [ -z $1 ]; then
67 if ( ! mysqladmin -s ping > /dev/null ); then
68 echo "Starting MySQL server"
69 ( /etc/init.d/mysql start ; status ) || exit
70 sleep 4 #let the mysql daemon start
71 fi
72 if ( ! mysql -Be 'show databases' | grep -q glpi ); then
73 echo -n "Create Glpi database"
74 mysql -Be "create database glpi" ; status
75 # We suppose that glpi user does not exist.
76 # It may be false.
77 echo -n "Create user glpi with password glpi"
78 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost'
79 identified by 'glpi'" ; status
80 # At last create the database for glpi.
81 echo -n "Create glpi database schema."
82 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-0.71.3-empty.sql ; status
84 fi
86 fi
87 }
89 post_remove()
90 {
91 echo -n "Would you like to remove data and database files.(y/n) "
92 read answer
94 case $answer in
95 y|Y)
96 echo -n "Removing data directories..."
97 rm -rf /var/lib/glpi ; status
98 if ( ! mysql -Be 'show databases' | grep -q glpi ); then
99 echo -n "Deleting Glpi database"
100 mysql -Be "drop database glpi" ; status
101 # We suppose that glpi user does not exist.
102 # It may be false.
103 echo -n "Delete user glpi"
104 mysql -Be "delete from mysql.db where user=glpi" ; status
105 fi
106 unset $answer
107 ;;
108 *)
109 ;;
110 esac
112 }