wok-next view glpi/receipt @ rev 21546
updated cgdb (0.7.0 -> 0.7.1)
author | Hans-G?nter Theisgen |
---|---|
date | Sun Jun 21 17:41:36 2020 +0100 (2020-06-21) |
parents | d43bf7aae921 |
children | 91e00e1a57ba |
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="devel@slitaz.org"
8 LICENSE="GPL2"
9 WEB_SITE="http://glpi-project.org/"
11 TARBALL="$PACKAGE-$VERSION.tar.gz"
12 WGET_URL="https://forge.indepnet.net/attachments/download/1054/$TARBALL"
14 genpkg_rules() {
15 mkdir -p $fs/usr/share/$PACKAGE \
16 $fs/etc/$PACKAGE \
17 $fs/var/log/$PACKAGE \
18 $fs/var/lib/$PACKAGE
20 cp -a $src/* $fs/usr/share/$PACKAGE
21 [ -d $fs/usr/share/$PACKAGE/files ] && mv $fs/usr/share/$PACKAGE/files $fs/var/lib/$PACKAGE
23 # Copy config db as temporary file.
24 cp $stuff/config_db.php $fs/etc/glpi/
25 cp -a $stuff/logrotate.d $fs/etc
27 cd $fs/usr/share/glpi
28 [ -f config/config_db.php ] && rm -f config/config_db.php
29 [ -f config/config_db_slave.php ] && rm -f config/config_db_slave.php
30 ln -s /etc/glpi/config_db.php config/
31 [ -f $fs/etc/glpi/config_db_slave.php ] && ln -s /etc/glpi/config_db_slave.php config/
32 ln -s /var/lib/glpi/files
33 cd -
34 chown -R www.www $fs/var/lib/$PACKAGE/files $fs/etc/$PACKAGE/*
36 # Create the magic file config_path.php
37 cat > $fs/usr/share/glpi/config/config_path.php <<EOF
38 <?php
39 // for packaging defaults
41 define("GLPI_CONFIG_DIR", "/etc/glpi");
43 define("GLPI_DOC_DIR", "/var/lib/glpi/files");
44 define("GLPI_DUMP_DIR", "/var/lib/glpi/files/_dumps");
45 define("GLPI_CACHE_DIR", "/var/lib/glpi/files/_cache/");
46 define("GLPI_CRON_DIR", "/var/lib/glpi/files/_cron");
47 define("GLPI_SESSION_DIR", "/var/lib/glpi/files/_sessions");
48 define("GLPI_PLUGIN_DOC_DIR", "/var/lib/glpi/files/_plugins");
49 define("GLPI_LOCK_DIR", "/var/lib/glpi/files/_lock/");
51 define("GLPI_LOG_DIR", "/var/log/glpi");
52 ?>
54 EOF
55 DEPENDS="mysql apache php-apache php-ldap php-imap php-mysql pam logrotate"
56 CONFIG_FILES="/etc/glpi/config_db.php"
57 }
59 post_install() {
60 # Configure apache server
61 if [ -f "$1/etc/apache/httpd.conf" ]; then
62 if [ ! -f "$1/etc/apache/conf.d/glpi" ]; then
63 cat > "$1/etc/apache/conf.d/glpi" <<EOT
64 <IfModule mod_alias.c>
65 Alias /glpi /usr/share/glpi/
66 </IfModule>
67 <Directory "/usr/share/glpi">
68 Options Indexes FollowSymLinks
70 php_value memory_limit 64M
72 AllowOverride None
73 Order deny,allow
74 Allow from all
75 </Directory>
77 <Directory /usr/share/glpi/config>
78 Order Allow,Deny
79 Deny from all
80 </Directory>
82 <Directory /usr/share/glpi/locales>
83 Order Allow,Deny
84 Deny from all
85 </Directory>
87 <Directory /usr/share/glpi/install/mysql>
88 Order Allow,Deny
89 Deny from all
90 </Directory>
92 <Directory /usr/share/glpi/scripts>
93 Order Allow,Deny
94 Deny from all
95 </Directory>
98 EOT
99 if [ -z "$1" ]; then
100 # Start Web server.
101 if [ -f /var/run/apache/httpd.pid ]; then
102 kill -0 $(cat /var/run/apache/httpd.pid) &&
103 /etc/init.d/apache restart
104 fi
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
117 if ( ! mysql -u root -Be 'show databases' | grep -q glpi ); then
118 action "Create Glpi database"
119 mysql -Be "create database glpi"
120 status
122 # We suppose that glpi user does not exist.
123 # It may be false.
124 action "Create user glpi with password glpi"
125 mysql -Be "grant all privileges on glpi.* to 'glpi'@'localhost'
126 identified by 'glpi'"
127 status
129 # At last create the database for glpi.
130 action "Create glpi database schema"
131 mysql -u glpi -pglpi -D glpi < /usr/share/glpi/install/mysql/glpi-0.80.3-empty.sql
132 status
133 fi
134 fi
135 true
136 }
138 post_remove() {
139 echo -n "Would you like to remove data and database files.(y/n) "
140 read answer
142 case $answer in
143 y|Y)
144 action "Removing data directories..."
145 rm -rf /var/lib/glpi
146 status
148 if ( mysql -u root -Be 'show databases' | grep -q glpi ); then
149 action "Deleting Glpi database"
150 mysql -Be "drop database glpi"
151 status
153 # We suppose that glpi user does not exist.
154 # It may be false.
155 action "Delete user glpi"
156 mysql -Be "delete from mysql.db where user='glpi'"
157 status
158 fi
159 ;;
160 esac
161 unset $answer
162 }