wok-6.x view glpi/receipt @ rev 15384

Add licenses
author Dominique Corbex <domcox@slitaz.org>
date Mon Oct 21 23:10:53 2013 +0200 (2013-10-21)
parents 012847ddd0cb
children d1c17bd2c2bc
line source
1 # SliTaz package receipt.
3 PACKAGE="glpi"
4 VERSION="0.80.7"
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 BUILD_DEPENDS="wget"
10 TARBALL="$PACKAGE-$VERSION.tar.gz"
11 WEB_SITE="http://glpi-project.org/"
12 WGET_URL="https://forge.indepnet.net/attachments/download/1054/$TARBALL"
13 CONFIG_FILES="/etc/glpi/config_db.php"
15 # Rules to gen a SliTaz package suitable for Tazpkg.
16 genpkg_rules()
17 {
18 mkdir -p $fs/usr/share/$PACKAGE \
19 $fs/etc/$PACKAGE \
20 $fs/var/log/$PACKAGE \
21 $fs/var/lib/$PACKAGE
23 cp -a $src/* $fs/usr/share/$PACKAGE
24 [ -d $fs/usr/share/$PACKAGE/files ] && mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE
26 # Copy config db as temporary file.
27 cp $stuff/config_db.php $fs/etc/glpi/
28 cp -a $stuff/logrotate.d $fs/etc
30 cd $fs/usr/share/glpi
31 [ -f config/config_db.php ] && rm -f config/config_db.php
32 [ -f config/config_db_slave.php ] && rm -f config/config_db_slave.php
33 ln -s /etc/glpi/config_db.php config/
34 [ -f $fs/etc/glpi/config_db_slave.php ] && ln -s /etc/glpi/config_db_slave.php config/
35 ln -s /var/lib/glpi/files
36 cd -
37 chown -R www.www $fs/var/lib/$PACKAGE/files $fs/etc/$PACKAGE/*
39 # Create the magic file config_path.php
40 cat <<EOF> $fs/usr/share/glpi/config/config_path.php
41 <?php
42 // for packaging defaults
44 define("GLPI_CONFIG_DIR", "/etc/glpi");
46 define("GLPI_DOC_DIR", "/var/lib/glpi/files");
47 define("GLPI_DUMP_DIR", "/var/lib/glpi/files/_dumps");
48 define("GLPI_CACHE_DIR", "/var/lib/glpi/files/_cache/");
49 define("GLPI_CRON_DIR", "/var/lib/glpi/files/_cron");
50 define("GLPI_SESSION_DIR", "/var/lib/glpi/files/_sessions");
51 define("GLPI_PLUGIN_DOC_DIR", "/var/lib/glpi/files/_plugins");
52 define("GLPI_LOCK_DIR", "/var/lib/glpi/files/_lock/");
54 define("GLPI_LOG_DIR", "/var/log/glpi");
55 ?>
57 EOF
58 }
60 post_install()
61 {
62 # Configure apache server
63 if [ -f $1/etc/apache/httpd.conf ]; then
64 if [ ! -f $1/etc/apache/conf.d/glpi ]; then
65 cat > $1/etc/apache/conf.d/glpi <<EOT
66 <IfModule mod_alias.c>
67 Alias /glpi /usr/share/glpi/
68 </IfModule>
69 <Directory "/usr/share/glpi">
70 Options Indexes FollowSymLinks
72 php_value memory_limit 64M
74 AllowOverride None
75 Order deny,allow
76 Allow from all
77 </Directory>
79 <Directory /usr/share/glpi/config>
80 Order Allow,Deny
81 Deny from all
82 </Directory>
84 <Directory /usr/share/glpi/locales>
85 Order Allow,Deny
86 Deny from all
87 </Directory>
89 <Directory /usr/share/glpi/install/mysql>
90 Order Allow,Deny
91 Deny from all
92 </Directory>
94 <Directory /usr/share/glpi/scripts>
95 Order Allow,Deny
96 Deny from all
97 </Directory>
100 EOT
101 if [ -z "$1" ]; then
102 # Start Web server.
103 test -f /var/run/apache/httpd.pid && \
104 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
105 fi
106 fi
107 fi
109 # Configure every thing for glpi.
110 if [ -z $1 ]; then
111 if ( ! mysqladmin -s ping > /dev/null ); then
112 echo "Starting MySQL server"
113 ( /etc/init.d/mysql start ; status ) || exit
114 sleep 4 #let the mysql daemon start
115 fi
116 if ( ! mysql -u root -Be 'show databases' | grep -q glpi ); then
117 echo -n "Create Glpi database"
118 mysql -Be "create database glpi" ; status
119 # We suppose that glpi user does not exist.
120 # It may be false.
121 echo -n "Create user glpi with password glpi"
122 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost'
123 identified by 'glpi'" ; status
124 # At last create the database for glpi.
125 echo -n "Create glpi database schema."
126 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-0.80.3-empty.sql ; status
128 fi
130 fi
131 }
133 post_remove()
134 {
135 echo -n "Would you like to remove data and database files.(y/n) "
136 read answer
138 case $answer in
139 y|Y)
140 echo -n "Removing data directories..."
141 rm -rf /var/lib/glpi ; status
142 if ( mysql -u root -Be 'show databases' | grep -q glpi ); then
143 echo -n "Deleting Glpi database"
144 mysql -Be "drop database glpi" ; status
145 # We suppose that glpi user does not exist.
146 # It may be false.
147 echo -n "Delete user glpi"
148 mysql -Be "delete from mysql.db where user='glpi'" ; status
149 fi
150 unset $answer
151 ;;
152 *)
153 ;;
154 esac
156 }