wok-next view glpi/receipt @ rev 20204
libjreen: update bdeps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Nov 03 22:50:48 2017 +0100 (2017-11-03) |
parents | 1067bb7f1e24 |
children | d43bf7aae921 |
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 LICENSE="GPL2"
9 TARBALL="$PACKAGE-$VERSION.tar.gz"
10 WEB_SITE="http://glpi-project.org/"
11 WGET_URL="https://forge.indepnet.net/attachments/download/1054/$TARBALL"
12 CONFIG_FILES="/etc/glpi/config_db.php"
14 DEPENDS="mysql apache php-apache php-ldap php-imap php-mysql pam logrotate"
15 BUILD_DEPENDS="wget"
17 # Rules to gen a SliTaz package suitable for Tazpkg.
18 genpkg_rules()
19 {
20 mkdir -p $fs/usr/share/$PACKAGE \
21 $fs/etc/$PACKAGE \
22 $fs/var/log/$PACKAGE \
23 $fs/var/lib/$PACKAGE
25 cp -a $src/* $fs/usr/share/$PACKAGE
26 [ -d $fs/usr/share/$PACKAGE/files ] && mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE
28 # Copy config db as temporary file.
29 cp $stuff/config_db.php $fs/etc/glpi/
30 cp -a $stuff/logrotate.d $fs/etc
32 cd $fs/usr/share/glpi
33 [ -f config/config_db.php ] && rm -f config/config_db.php
34 [ -f config/config_db_slave.php ] && rm -f config/config_db_slave.php
35 ln -s /etc/glpi/config_db.php config/
36 [ -f $fs/etc/glpi/config_db_slave.php ] && ln -s /etc/glpi/config_db_slave.php config/
37 ln -s /var/lib/glpi/files
38 cd -
39 chown -R www.www $fs/var/lib/$PACKAGE/files $fs/etc/$PACKAGE/*
41 # Create the magic file config_path.php
42 cat <<EOF> $fs/usr/share/glpi/config/config_path.php
43 <?php
44 // for packaging defaults
46 define("GLPI_CONFIG_DIR", "/etc/glpi");
48 define("GLPI_DOC_DIR", "/var/lib/glpi/files");
49 define("GLPI_DUMP_DIR", "/var/lib/glpi/files/_dumps");
50 define("GLPI_CACHE_DIR", "/var/lib/glpi/files/_cache/");
51 define("GLPI_CRON_DIR", "/var/lib/glpi/files/_cron");
52 define("GLPI_SESSION_DIR", "/var/lib/glpi/files/_sessions");
53 define("GLPI_PLUGIN_DOC_DIR", "/var/lib/glpi/files/_plugins");
54 define("GLPI_LOCK_DIR", "/var/lib/glpi/files/_lock/");
56 define("GLPI_LOG_DIR", "/var/log/glpi");
57 ?>
59 EOF
60 }
62 post_install()
63 {
64 # Configure apache server
65 if [ -f "$1/etc/apache/httpd.conf" ]; then
66 if [ ! -f "$1/etc/apache/conf.d/glpi" ]; then
67 cat > "$1/etc/apache/conf.d/glpi" <<EOT
68 <IfModule mod_alias.c>
69 Alias /glpi /usr/share/glpi/
70 </IfModule>
71 <Directory "/usr/share/glpi">
72 Options Indexes FollowSymLinks
74 php_value memory_limit 64M
76 AllowOverride None
77 Order deny,allow
78 Allow from all
79 </Directory>
81 <Directory /usr/share/glpi/config>
82 Order Allow,Deny
83 Deny from all
84 </Directory>
86 <Directory /usr/share/glpi/locales>
87 Order Allow,Deny
88 Deny from all
89 </Directory>
91 <Directory /usr/share/glpi/install/mysql>
92 Order Allow,Deny
93 Deny from all
94 </Directory>
96 <Directory /usr/share/glpi/scripts>
97 Order Allow,Deny
98 Deny from all
99 </Directory>
102 EOT
103 if [ -z "$1" ]; then
104 # Start Web server.
105 test -f /var/run/apache/httpd.pid && \
106 ( kill -0 $(cat /var/run/apache/httpd.pid) && /etc/init.d/apache restart )
107 fi
108 fi
109 fi
111 # Configure every thing for glpi.
112 if [ -z "$1" ]; then
113 if ( ! mysqladmin -s ping > /dev/null ); then
114 echo "Starting MySQL server"
115 ( /etc/init.d/mysql start ; status ) || exit
116 sleep 4 #let the mysql daemon start
117 fi
118 if ( ! mysql -u root -Be 'show databases' | grep -q glpi ); then
119 echo -n "Create Glpi database"
120 mysql -Be "create database glpi" ; status
121 # We suppose that glpi user does not exist.
122 # It may be false.
123 echo -n "Create user glpi with password glpi"
124 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost'
125 identified by 'glpi'" ; status
126 # At last create the database for glpi.
127 echo -n "Create glpi database schema."
128 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-0.80.3-empty.sql ; status
130 fi
132 fi
133 true
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 }