wok view glpi/receipt @ rev 5886
privoxy: fix post_install
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Jul 21 16:47:50 2010 +0200 (2010-07-21) |
parents | 2077fae2c4c3 |
children | 9ece8f68b694 |
line source
1 # SliTaz package receipt.
3 PACKAGE="glpi"
4 VERSION="0.72.3"
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 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
62 # Configure every thing for glpi.
63 if [ -z $1 ]; then
64 if ( ! mysqladmin -s ping > /dev/null ); then
65 echo "Starting MySQL server"
66 ( /etc/init.d/mysql start ; status ) || exit
67 sleep 4 #let the mysql daemon start
68 fi
69 if ( ! mysql -u root -Be 'show databases' | grep -q glpi ); then
70 echo -n "Create Glpi database"
71 mysql -Be "create database glpi" ; status
72 # We suppose that glpi user does not exist.
73 # It may be false.
74 echo -n "Create user glpi with password glpi"
75 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost'
76 identified by 'glpi'" ; status
77 # At last create the database for glpi.
78 echo -n "Create glpi database schema."
79 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-${VERSION}-empty.sql ; status
81 fi
83 fi
84 }
86 post_remove()
87 {
88 echo -n "Would you like to remove data and database files.(y/n) "
89 read answer
91 case $answer in
92 y|Y)
93 echo -n "Removing data directories..."
94 rm -rf /var/lib/glpi ; status
95 if ( mysql -u root -Be 'show databases' | grep -q glpi ); then
96 echo -n "Deleting Glpi database"
97 mysql -Be "drop database glpi" ; status
98 # We suppose that glpi user does not exist.
99 # It may be false.
100 echo -n "Delete user glpi"
101 mysql -Be "delete from mysql.db where user='glpi'" ; status
102 fi
103 unset $answer
104 ;;
105 *)
106 ;;
107 esac
109 }