wok view glpi/receipt @ rev 8455

Fixed spidermonkey.
author Christopher Rogers <slaxemulator@gmail.com>
date Sun Feb 06 19:18:49 2011 +0000 (2011-02-06)
parents 9ece8f68b694
children be13f25e790b
line source
1 # SliTaz package receipt.
3 PACKAGE="glpi"
4 VERSION="0.78.2"
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 logrotate"
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
10 WEB_SITE="http://glpi-project.org/"
11 WGET_URL="https://forge.indepnet.net/attachments/download/772/$TARBALL"
12 CONFIG_FILES="/etc/glpi/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/log/$PACKAGE \
24 $fs/var/lib/$PACKAGE
26 cp -a $_pkg/* $fs/usr/share/$PACKAGE
27 [ -d $fs/usr/share/$PACKAGE/files ] && mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE
29 # Copy config db as temporary file.
30 cp stuff/config_db.php $fs/etc/glpi/
31 cp -a stuff/logrotate.d $fs/etc
33 cd $fs/usr/share/glpi
34 [ -f config/config_db.php ] && rm -f config/config_db.php
35 [ -f config/config_db_slave.php ] && rm -f config/config_db_slave.php
36 ln -s /etc/glpi/config_db.php config/
37 [ -f $fs/etc/glpi/config_db_slave.php ] && ln -s /etc/glpi/config_db_slave.php config/
38 ln -s /var/lib/glpi/files
39 cd -
40 chown -R www.www $fs/var/lib/$PACKAGE/files $fs/etc/$PACKAGE/*
42 # Create the magic file config_path.php
43 cat <<EOF> $fs/usr/share/glpi/config/config_path.php
44 <?php
45 // for packaging defaults
47 define("GLPI_CONFIG_DIR", "/etc/glpi");
49 define("GLPI_DOC_DIR", "/var/lib/glpi/files");
50 define("GLPI_DUMP_DIR", "/var/lib/glpi/files/_dumps");
51 define("GLPI_CACHE_DIR", "/var/lib/glpi/files/_cache/");
52 define("GLPI_CRON_DIR", "/var/lib/glpi/files/_cron");
53 define("GLPI_SESSION_DIR", "/var/lib/glpi/files/_sessions");
54 define("GLPI_PLUGIN_DOC_DIR", "/var/lib/glpi/files/_plugins");
55 define("GLPI_LOCK_DIR", "/var/lib/glpi/files/_lock/");
57 define("GLPI_LOG_DIR", "/var/log/glpi");
58 ?>
60 EOF
61 }
63 post_install()
64 {
65 # Configure apache server
66 if [ -f $1/etc/apache/httpd.conf ]; then
67 if [ ! -f $1/etc/apache/conf.d/glpi ]; then
68 cat > $1/etc/apache/conf.d/glpi <<EOT
69 <IfModule mod_alias.c>
70 Alias /glpi /usr/share/glpi/
71 </IfModule>
72 <Directory "/usr/share/glpi">
73 Options Indexes FollowSymLinks
75 php_value memory_limit 64M
77 AllowOverride None
78 Order deny,allow
79 Allow from all
80 </Directory>
82 <Directory /usr/share/glpi/config>
83 Order Allow,Deny
84 Deny from all
85 </Directory>
87 <Directory /usr/share/glpi/locales>
88 Order Allow,Deny
89 Deny from all
90 </Directory>
92 <Directory /usr/share/glpi/install/mysql>
93 Order Allow,Deny
94 Deny from all
95 </Directory>
97 <Directory /usr/share/glpi/scripts>
98 Order Allow,Deny
99 Deny from all
100 </Directory>
103 EOT
104 if [ -z "$1" ]; then
105 # Start Web server.
106 test -f /var/run/apache/httpd.pid && \
107 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
108 fi
109 fi
110 fi
112 # Configure every thing for glpi.
113 if [ -z $1 ]; then
114 if ( ! mysqladmin -s ping > /dev/null ); then
115 echo "Starting MySQL server"
116 ( /etc/init.d/mysql start ; status ) || exit
117 sleep 4 #let the mysql daemon start
118 fi
119 if ( ! mysql -u root -Be 'show databases' | grep -q glpi ); then
120 echo -n "Create Glpi database"
121 mysql -Be "create database glpi" ; status
122 # We suppose that glpi user does not exist.
123 # It may be false.
124 echo -n "Create user glpi with password glpi"
125 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost'
126 identified by 'glpi'" ; status
127 # At last create the database for glpi.
128 echo -n "Create glpi database schema."
129 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-${VERSION}-empty.sql ; status
131 fi
133 fi
134 }
136 post_remove()
137 {
138 echo -n "Would you like to remove data and database files.(y/n) "
139 read answer
141 case $answer in
142 y|Y)
143 echo -n "Removing data directories..."
144 rm -rf /var/lib/glpi ; status
145 if ( mysql -u root -Be 'show databases' | grep -q glpi ); then
146 echo -n "Deleting Glpi database"
147 mysql -Be "drop database glpi" ; status
148 # We suppose that glpi user does not exist.
149 # It may be false.
150 echo -n "Delete user glpi"
151 mysql -Be "delete from mysql.db where user='glpi'" ; status
152 fi
153 unset $answer
154 ;;
155 *)
156 ;;
157 esac
159 }