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